Varnish does not start properly (crashes after startup) with no error messages

Posted by Matthew Savage on Server Fault See other posts from Server Fault or by Matthew Savage
Published on 2010-05-15T07:33:34Z Indexed on 2010/05/15 7:34 UTC
Read the original article Hit count: 275

Filed under:
|
|

I am running Varnish (2.0.4 from the Ubuntu unstable apt repository, though I have also used the standard repository) in a test environment (Virtual Machines) on Ubuntu 9.10, soon to be 10.04.

When I have a working configuration and the server starts successfully it seems like everything is fine, however if, for whatever reason, I stop and then restart the varnish daemon it doesn't always startup properly, and there are no errors going into syslog or messages to indicate what might be wrong.

If I run varnish in debug mode (-d) and issue start when prompted then 7 times out of time it will run, but occasionally it will just shut down 'silently'.

My startup command is (the $1 allows for me to pass -d to the script this lives in):

varnishd -a :80 $1 \
-T 127.0.0.1:6082 \
-s malloc,1GB \
-f /home/deploy/mysite.vcl \
-u deploy \
-g deploy \
-p obj_workspace=4096 \
-p sess_workspace=262144 \
-p listen_depth=2048 \
-p overflow_max=2000 \
-p ping_interval=2 \
-p log_hashstring=off \
-h classic,5000009 \
-p thread_pool_max=1000 \
-p lru_interval=60 \
-p esi_syntax=0x00000003 \
-p sess_timeout=10 \
-p thread_pools=1 \
-p thread_pool_min=100 \
-p shm_workspace=32768 \
-p thread_pool_add_delay=1

and the VCL looks like this:

# nginx/passenger server, HTTP:81
backend default {
.host = "127.0.0.1";
.port = "81";
}

sub vcl_recv {
  # Don't cache the /useradmin or /admin path
  if (req.url ~ "^/(useradmin|admin|session|sessions|login|members|logout|forgot_password)") {
    pipe;
  }

  # If cache is 'regenerating' then allow for old cache to be served
  set req.grace = 2m;

  # Forward to cache lookup
  lookup;
}

# This should be obvious
sub vcl_hit {
  deliver;
}

sub vcl_fetch {
  # See link #16, allow for old cache serving
  set obj.grace = 2m;

  if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
    deliver;
  }

  remove obj.http.Set-Cookie;
  remove obj.http.Etag;

  set obj.http.Cache-Control = "no-cache";
  set obj.ttl = 7d;
  deliver;
}

Any suggestions would be greatly appreciated, this is driving me absolutely crazy, especially because its such an inconsistent behaviour.

© Server Fault or respective owner

Related posts about varnish

Related posts about reverse-proxy