Varnish appears to hang/requests time out

Martin Aspeli optilude at gmx.net
Sun Aug 26 01:46:58 CEST 2007


Hi guys,

I'm having some trouble with Varnish 1.1.1 tarball and 1.1 branch in svn 
(r1922), and trunk as of today.

Basically, I use a setup where I have Apache with virtual hosting, in 
front of Varnish (VCL included) in front of Zope/Plone (Plone 3 with 
CacheFu 1.1, in case that means anything to you, it hopefully shouldn't 
matter).

It's hard to debug, but Varnish appears to hang, in that requests never 
complete. Not always, but between five or ten requests, I can make a few 
do this.

I can't spot an obvious pattern, but it's normally either a page or a JS 
or CSS request. It happens sometimes on basic GET requests, and more 
often on POST requests.

Is this familiar to anyone? Can I do anything more useful to debug?

The VCL is:

backend backend_0 {
     set backend.host = "127.0.0.1";
     set backend.port = "8080";
}



acl purge {
     "localhost";
}

sub vcl_recv {


     if (req.request == "PURGE") {
         if (!client.ip ~ purge) {
                 error 405 "Not allowed.";
         }
         lookup;
     }

     if (req.request != "GET" && req.request != "HEAD") {
         # Do not try to cache POST
	pipe;
     }

     if (req.http.Expect) {
         pipe;
     }

     if (req.http.If-None-Match) {
         pass;
     }

     /* Always cache images and binaries */
     if (req.url ~ 
"\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$") 
{
         lookup;
     }
     /* Always cache CSS and javascript */
     if (req.url ~ "\.(css|js)$") {
         lookup;
     }

     /* Do not cache other authorised content */
     if (req.http.Authenticate || req.http.Authorization) {
         pass;
     }

     /* We only care about the "__ac.*" cookies, used for authentication */
     if (req.http.Cookie && (req.http.Cookie ~ 
"__ac(_(name|password|persistent))?=" || req.http.Cookie ~ "_ZopeId")) {
         pass;
     }

     lookup;
}

/* Deal with purge requests */
sub vcl_hit {
     if (req.request == "PURGE") {
             set obj.ttl = 0s;
             error 200 "Purged";
     }
}

sub vcl_miss {
     if (req.http.If-Modified-Since) {
         pass;
     }

     if (req.request == "PURGE") {
             error 404 "Not in cache";
     }
}

sub vcl_fetch {
     if (!obj.valid) {
         error;
     }
     if (!obj.cacheable) {
         pass;
     }
     if (obj.http.Set-Cookie) {
         pass;
     }

     if (req.url ~ "(rss_|search_rss)") {
         set obj.ttl = 1800s;
     }
}


Cheers,
Martin

-- 
Acquisition is a jealous mistress




More information about the varnish-misc mailing list