[Varnish] #397: varnish panic and restarts every 3-5 minutes

Varnish varnish-bugs at projects.linpro.no
Sat Nov 29 14:41:13 CET 2008


#397: varnish panic and restarts every 3-5 minutes
----------------------------+-----------------------------------------------
 Reporter:  maheshollalwar  |       Owner:  phk                
     Type:  defect          |      Status:  new                
 Priority:  high            |   Milestone:  Varnish 2.1 release
Component:  varnishd        |     Version:  2.0                
 Severity:  major           |    Keywords:                     
----------------------------+-----------------------------------------------
 Hi,

 Varnish is restarting in every 3-5 minutes with a panic message.

 Nov 29 13:28:05 varnish-vsnl1 varnishd[19560]: Child (19640) Panic
 message: Assert error in WS_Release(), cache_ws.c line 170:
 Condition(bytes <= ws->e - ws->f) not true.  thread = (cache-worker)sp =
 0x1f594004 {   fd = 61, id = 61, xid = 596033830,   client =
 117.193.199.92:1242,   step = STP_HIT,   handling = 0x0,   ws = 0x1f59404c
 {      id = "sess",     {s,f,r,e} = {0x1f5944dc,,+795,(nil),+8192},   },
 worker = 0x214ff170 {     },     vcl = {       srcname = {
 "/etc/varnish/rediff.vcl",         "Default",       },     },   obj =
 0x8e9d4000 {     refcnt = 2, xid = 596017492,     ws = 0x8e9d4018 {
 id = "obj",       {s,f,r,e} = {0x8e9d41ec,,+3586,+3604,+3604},     },
 http = {       ws = 0x8e9d4018 {          id = "obj",         {s,f,r,e} =
 {0x8e9d41ec,,+3586,+3604,+3604},       },       hd = {         "Date: Sat,
 29 Nov 2008 13:20:06 GMT",         "Last-Modified: Fri, 28 Nov 2008
 10:35:22 GMT",         "ETag: "6bc68-5fea-492fc96a"",         "Content-
 Type: image/jpeg",         "Content-Length


 Below is my configuration.

 backend datastore {
         .host = "ds.rediff.com";
         .port = "80";
 }

 backend adsstore {
         .host = "ads.rediff.com";
         .port = "80";
 }

 backend imads {
         .host = "ads.rediff.com";
         .port = "80";
 }



 acl purge {
     "localhost";
     "202.137.232.0"/21;
     "203.197.35.0"/25;
     "202.54.124.128"/25;
     "203.199.83.0"/24;
     "59.160.240.0"/24;
     "220.226.195.0"/24;
 }

 sub vcl_recv {
         if (req.http.host ~ "^datastore.rediff.com") {
                 set req.backend = datastore;
         }elseif ( req.http.host ~ "^adsstore.rediff.com") {
                 set req.backend = adsstore;
         }elseif ( req.http.host ~ "^imads.rediff.com") {
                 set req.backend = imads;
         }else{
                 error 401 "Bad Domain";
         }
         if (req.request == "PURGE") {
                 if(!client.ip ~ purge) {
                         error 405 "Not Allowed";
                 }
                 lookup;
         }
         if (req.request != "GET" && req.request != "HEAD") {
                 pipe;
         }
         if (req.http.Expect) {
                 pipe;
           }
         # normalize the Accept-Encoding header
         if (req.http.Accept-Encoding) {
                 if (req.url ~
 "\.(JPG|PNG|GIF|Jpg|Png|Gif|jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|flv|mp4|m4v)$")
 {
                 # No point in compressing these
                 remove req.http.Accept-Encoding;
                 } elseif (req.http.Accept-Encoding ~ "gzip") {
                         set req.http.Accept-Encoding = "gzip";
                 } elseif (req.http.Accept-Encoding ~ "deflate") {
                         set req.http.Accept-Encoding = "deflate";
                 } else {
                         # unkown algorithm
                         remove req.http.Accept-Encoding;
                 }
         }

         lookup;
 }

 sub vcl_pipe {
         pipe;
 }
 #
 ## Called when entering pass mode
 #
 sub vcl_pass {
         pass;
 }

 sub vcl_hit {
         if (req.request == "PURGE") {
                 set obj.ttl = 0s;
                 error 200 "Purged.";
         }
         if (!obj.cacheable) {
                 pass;
         }
        if (req.url ~
 "\.(aif|aiff|au|avi|bin|bmp|cab|carb|cct|cdf|class|dcr|doc|dtd|exe|gcf|gff|grv|hdml|hqx|ico|ini|mov|mp3|nc|pct|pdf|ppc|pws|swa|swf|txt|vbs|w32|wav|wbmp|wml|wmlc|wmls|wmlsc|xml|xsd|xsl|zip)$")
 {
                 if (req.http.host ~ "^imads.rediff.com") {
                 set obj.ttl = 604800s;
                 }else{
                set obj.ttl = 2592000s;
                 }
        }

        if (req.url ~ "\.(css|js|htm|html)$") {
                 remove obj.http.Via;
                 remove obj.http.Age;
                 remove obj.http.X-Varnish;
 #                remove obj.http.Vary;
                 if (req.http.host ~ "^imads.rediff.com") {
                 set obj.http.Cache-Control = "max-age=604800";
                 set obj.ttl = 604800s;
                 }else{
                 set obj.http.Cache-Control = "max-age=2592000";
                 set obj.ttl = 2592000s;
                 }
         }
         if (req.url ~
 "\.(JPG|PNG|GIF|Jpg|Png|Gif|flv|gif|jpeg|jpg|png|mp4|m4v)$") {
                 remove obj.http.Via;
                 remove obj.http.Age;
                 remove obj.http.X-Varnish;
                 remove obj.http.Vary;
        if (req.http.host ~ "^imads.rediff.com") {
                 set obj.http.Cache-Control = "max-age=604800";
                 set obj.ttl = 604800s;
         }else{
                 set obj.http.Cache-Control = "max-age=2592000";
                 set obj.ttl = 2592000s;
         }
         }
         set obj.http.Server = "Rediff CDN";
         deliver;
 }
 #
 #sub vcl_hash {
 #       set req.hash += req.url;
 #       hash;
 #}
 ## Called when the requested object was not found in the cache
 #
 sub vcl_miss {
         if (req.request == "PURGE") {
                 error 404 "Not in cache.";
         }
         fetch;
 }

 sub vcl_fetch {
        if (!obj.cacheable) {
                pass;
        }
        if (obj.http.Set-Cookie) {
                pass;
        }
        if (obj.status == 500 || obj.status == 501 || obj.status == 502 ||
 obj.status == 503 || obj.status == 504){
         set obj.ttl = 0s ;
         }
        if (req.url ~ "\.(css|js|html|htm)$") {
         if (req.http.host ~ "^imads.rediff.com") {
                set obj.ttl = 604800s ;
                set obj.http.cache-control = "max-age=604800";
         }else{
                 set obj.ttl = 2592000s ;
                set obj.http.cache-control = "max-age=2592000";
         }
         }
         if (req.url ~
 "\.(JPG|PNG|GIF|Jpg|Png|Gif|flv|gif|jpeg|jpg|png|mp4|m4v|swf)$") {
         if (req.http.host ~ "^imads.rediff.com") {
                 set obj.ttl = 604800s ;
                set obj.http.cache-control = "max-age=604800";
         }else{
                set obj.ttl = 2592000s ;
                set obj.http.cache-control = "max-age=2592000";
         }
         }
         deliver;
 }

 sub vcl_deliver {
                 remove resp.http.Via;
                 remove resp.http.Age;
                 remove resp.http.X-Varnish;
 #               remove resp.http.Vary;
     deliver;
 }
 #
 ## Called when an object nears its expiry time
 #
 sub vcl_timeout {
         discard;
 }
 #
 ## Called when an object is about to be discarded
 #
 sub vcl_discard {
     discard;
 }



 DAEMON_OPTS="-a :80 \
              -T localhost:6082 \
              -f /etc/varnish/rediff.vcl \
              -u varnish -g varnish \
              -p thread_pool_max=4000 \
              -p thread_pools=4 \
              -p listen_depth=4096 \
              -p lru_interval=3600 \
              -h classic,500009 \
              -p obj_workspace=4096 \
              -s file,/var/lib/varnish/storage.bin,1G \
              -s file,/var/lib/varnish/storage1.bin,1G"

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/397>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list