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

3

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.

reverse-proxy
varnish
asked on Server Fault May 15, 2010 by Matthew Savage

2 Answers

2

When debug mode and error files are not helping, strace is our best friend.

Type strace -f -o strace.out before your varnish start command, so that strace can trace all your system calls.

Then, take a look at strace.out, especially the last lines. In this particular situations, strace is always a good tool to enlighten the way.

Hope this helps.

answered on Server Fault May 15, 2010 by Marco Ramos • edited Apr 22, 2011 by Marco Ramos
0

Upgrade to 2.1.2

http://sourceforge.net/projects/varnish/files/

You can probably use alien to install the RPM version (as a test) and then change the Debian package stuff from 2.0 to create a 2.1.2 .deb

answered on Server Fault Jun 9, 2010 by Thiago Figueiro

User contributions licensed under CC BY-SA 3.0