Apr 8, 2012

Varnish Running VCC-compiler failed on purge


I’ve been following this guide which uses this default.vcl. However, when starting Varnish I get the following error:

 * Starting HTTP accelerator                                                                                                                                                                                                                                           [fail] 
storage_malloc: max size 1024 MB.
Message from VCC-compiler:
Expected '(' got ';'
(program line 341), at
(input Line 43 Pos 22)
Running VCC-compiler failed, exit 1
VCL compilation failed

Which means that there is something wrong with purge here:

sub vcl_hit {
        if (req.request == "PURGE") {
                error 200 "Purged.";

I don’t see anything wrong, can someone explain?


Asked by FLX


The code block you have used is perfectly valid – in fact I use a nearly identical one with my Varnish setup (and I presume many others do as well).

As the error suggests there is a problem with purge. Since purge was only introduced in Varnish 3.x, if you are using a prior version of Varnish (2.x) the command will be unrecognised, and compilation will fail. You can determine your version of Varnish by running varnishd -V.

If you are using a previous version of Varnish, and are unable to upgrade, the equivalent command is set obj.ttl = 0s;.

Varnish maintains up-to-date repositories for Ubuntu/Debian and RHEL/CentOS distributions on their download page.

Answered by cyberx86

Related posts:

  1. Varnish Running VCC-compiler failed
  2. Varnish VCL Reload Fails After Adding Second Backend
  3. Squid client purge utility
  4. Nginx running behind Varnish and x-forwarded-for, how do I fool nginx?
  5. Fixing error 403 with Varnish cache

Leave a comment