Panic Signal 6.

Ben Nowacky bnowacky at competitorgroup.com
Thu Sep 30 21:10:21 CEST 2010


We're running CentOS 64 bit, 5.5... Here's our VCL, and startup flags:

sysconfig/varnish:
-u varnish
-s malloc,800m
-p cli_timeout=1200s
-p thread_pools=1
-p thread_pool_min=120
-p thread_pool_max=200
-p listen_depth=1024
p shm_reclen=32768
-p sess_workspace=8192
-p http_headers=32
-p sess_timeout=10
-p session_linger=100
-p between_bytes_timeout=10
-p first_byte_timeout=10
-h critbit


VCL:
# Default backend definition.  Set this to point to your content
# server.
#
 backend default {
     .host = "64.237.104.85";
     .port = "8080";
 }


acl purge {
"localhost";
"64.237.104.85";
}


sub vcl_recv {
# Serve stale content while fresh is retrieved for 2minutes.
set req.grace = 6m;
if (req.http.host ~ "elite.competitor.com<http://elite.competitor.com/>") {
if (req.url ~ "^/confcard$") {
set req.http.New-Location = regsub(req.url,"$","/");
    error 301 "Redirecting you to the slash representation...";
}
if (req.url ~ "^/confcard/") {
return (pipe);
}
}
if (req.http.host ~ "forums.competitor.com<http://forums.competitor.com/>") {
return (pipe);
}
if (req.http.host ~ "svn.competitor.com<http://svn.competitor.com/>"){
return (pipe);
}
if (req.http.host ~ "competitorradio.competitor.com<http://competitorradio.competitor.com/>") {
if (req.url ~ "^/wp-admin$") {
     set req.http.New-Location = regsub(req.url,"$","/");
    error 301 "Redirecting you to the slash representation...";
    }
else {
return (pipe);
}
}

# always exempt Dev.lan from cache.
if (!(req.http.host ~ "competitor.com<http://competitor.com/>")) {
return (pipe);
}
# Exempt mobile users from cache... straight to backend.
  if (req.http.User-Agent ~ "(iPhone|iPod|iPad)|(Android)|(BlackBerry9530)|(webOS)") {
return (pipe);
}
# redirect URL for trailing slash when logging in.
  if (req.url ~ "^/wp-admin$") {
     set req.http.New-Location = regsub(req.url,"$","/");
    error 301 "Redirecting you to the slash representation...";
    }

    if (req.http.cookie ~ "wordpress_") {
return (pipe);
}
# if wp-admin or wp-login is in the URL, pipe to apache.
if (req.url ~ "/wp-(admin|login)") {
     return (pipe);
    }
    # otherwise just unset cookie and cache all pages.
    else  {
       unset req.http.cookie;
    }




#    # cache the home page.
#    if (req.url ~ "^/$") {
#        unset req.http.cookie;
#     }
#     #category page
#     if (req.url ~ "^/category(.)*") {
#     unset req.http.cookie;
#     }
#     #post page with date in URL
#     if (req.url ~ "^/?p=[0-9](.)*") {
#     unset req.http.cookie;
#    }
#       #post page with date in URL
#     if (req.url ~ "^/[0-9](.)*") {
#     unset req.http.cookie;
#     }

     if (req.http.Accept-Encoding) {
     if (req.url ~ "^/[^?]+\.(ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.*|)$") {
     # No point in compressing these
             remove req.http.Accept-Encoding;
         } elsif (req.http.Accept-Encoding ~ "gzip") {
             set req.http.Accept-Encoding = "gzip";
         } elsif (req.http.Accept-Encoding ~ "deflate") {
             set req.http.Accept-Encoding = "deflate";
         } elsif (req.http.Accept-Encoding ~ "MSIE 6") {
             set req.http.Accept-Encoding = "MSIE";
         } elsif (req.http.Accept-Encoding ~ "MSIE 7") {
             set req.http.Accept-Encoding = "MSIE";
         } elsif (req.http.Accept-Encoding ~ "MSIE 8") {
             set req.http.Accept-Encoding = "MSIE";
         } elsif (req.http.Accept-Encoding ~ "Mozilla") {
             set req.http.Accept-Encoding = "mozilla";
         }
        else {
              # unkown algorithm
             remove req.http.Accept-Encoding;
         }
     }


     unset req.http.user-agent;

     if (req.url ~ "^/[^?]+\.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.*|)$") {
  remove req.http.cookie;
  set req.url = regsub(req.url, "\?.*$", "");
  }

  # don't bother caching large files
  if (req.url ~ "^/[^?]+\.(mp3|pdf|flv|mov|mp4|mpg|mpeg|avi|dmg|swf)(\?.*|)$") {
    return (pipe);
    }

        # accept purge requests from Wordpress.
  if (req.request == "PURGE") {
  if(!client.ip ~ purge) {
  error 405 "Not allowed.";
  }
purge_url(req.url);
error 200 "Purged";
  purge("req.url == " req.url);
  }



 ####################
 # End sub_recv #
 ####################
}


sub vcl_deliver {
#add cache hit data
if (obj.hits > 0) {
#if hit add hit count
set resp.http.X-Served-By = server.hostname;
set resp.http.X-Cache = "HIT";
set resp.http.X-Cache-Hits = obj.hits;
set resp.http.X-Encoding = req.http.Accept-Encoding;
set resp.http.X-Debug = req.http.host;
} else {
set resp.http.X-Served-By = server.hostname;
set resp.http.X-Cache = "MISS";
set resp.http.X-Encoding = req.http.Accept-Encoding;
set resp.http.X-Debug = req.http.host;
}
}



sub vcl_error {
# for redirect on trailing slash.
if (req.http.New-Location) {
set obj.http.Location = req.http.New-Location;
}
}

sub vcl_fetch {

if (beresp.status != 200 && beresp.status != 403 && beresp.status != 404 && beresp.status != 405 && beresp.status != 301 && beresp.status != 302) {
     restart;
    }

    if (beresp.http.cookie ~ "wordpress_") {
return (pass);
}

# Serve stale content while fresh is retrieved for 2minutes.
set beresp.grace = 6m;
set beresp.ttl = 720s;
if (beresp.ttl < 720s) {
    set beresp.ttl = 720s;
   }

   if (!beresp.cacheable) {
   set beresp.ttl = 0s;
   }

   if (beresp.http.Set-Cookie) {
   return(deliver);
   }

# make sure cookies aren't set for retrieved static objects.
 if (req.url ~ "^/[^?]+\.(jpeg|jpg|png|gif|ico)(\?.*|)$") {
  set beresp.http.Cache-Control = "max-age=31536000, public";
  unset beresp.http.set-cookie;
    }

    if (req.url ~ "^/[^?]+\.(js|html|htm|txt)(\?.*|)$") {
set beresp.http.Cache-Control = "max-age=1728000, public, must-revalidate";
  unset beresp.http.set-cookie;
    }

    if (req.url ~ "^/[^?]+\.(css)(\?.*|)$") {
  set beresp.http.Cache-Control = "max-age=1728000, public, must-revalidate";
  unset beresp.http.set-cookie;
  }

  # cache the home page.
    if (req.url ~ "^/$") {
       unset beresp.http.cookie;
       set beresp.ttl = 600s;
    }

    if (req.url ~ "^/category(.)*") {
     unset beresp.http.cookie;
    }

    if (req.url ~ "^(.)/[0-9](.)*") {
     unset beresp.http.cookie;
    }
    if (req.url ~ "^/?p=[0-9](.)*") {
     unset beresp.http.cookie;
    }


  #Change Web Server header because we can.
  unset beresp.http.Server;
  set beresp.http.Server = "Mini Con Adventure Team";

 ####################
 # End sub_fetch #
 ####################
}

sub vcl_pipe {
#    # http://www.varnish-cache.org/ticket/451
#    # This forces every pipe request to be the first one.
   set bereq.http.connection = "close";
}


sub vcl_hit {
if (req.request == "PURGE") {
  set obj.ttl = 0s;
  error 200 "Purged.";
  }
}


sub vcl_hash {

#  //hash the object with url+host

set req.hash += req.url;
set req.hash += req.http.host;
set req.hash += req.http.User-Agent;
set req.hash += req.http.cookie;
return(hash);
}










On Sep 30, 2010, at 12:06 PM, Ross Brown wrote:

2 Days? That’s certainly…. sub-optimal. What OS are you running? Our 8 x Varnish servers (64-bit Ubuntu 10.04.1 LTS) are rock solid and easily run for weeks without any issues.

We run with malloc,24G (32Gb RAM installed)

Can you share your startup options and VCL?


From: varnish-misc-bounces at varnish-cache.org<mailto:varnish-misc-bounces at varnish-cache.org> [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Ben Nowacky
Sent: Friday, 1 October 2010 7:02 a.m.
To: Caunter, Stefan
Cc: varnish-misc at varnish-cache.org<mailto:varnish-misc at varnish-cache.org>
Subject: Re: Panic Signal 6.

2.1.2, would prefer to use malloc over file storage if possible, but haven't tried file to see if that's the issue.


On Sep 30, 2010, at 10:57 AM, Caunter, Stefan wrote:


What version of varnish? Have you tried with –s file,/path/to/file ,1075200000 instead of –s malloc?

Stefan Caunter :: Senior Systems Administrator :: TOPS
e: scaunter at topscms.com<mailto:scaunter at topscms.com>  ::  m: (416) 561-4871
www.thestar.com<http://www.thestar.com> www.topscms.com<http://www.topscms.com>

From: varnish-misc-bounces at varnish-cache.org<mailto:varnish-misc-bounces at varnish-cache.org> [mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Ben Nowacky
Sent: September-30-10 12:53 PM
To: varnish-misc at varnish-cache.org<mailto:varnish-misc at varnish-cache.org>Subject: Panic Signal 6.

Hey everyone ! Wondering if someone can lend a hand. We've gotten our servers upgraded to 64-bit OS, and seen tremendous stability enhancement with varnish over our 32-bit os, which crashed every 5-10 minutes. We can now get about 2 days of uptime before we have a new child process crash. Logs are listed below.. Wondering if something obvious jumps out at anyone as to what the cause of this may be.

Appreciate any insight from the community !

Sep 30 16:37:17 srv860 varnishd[16195]: Child (16196) died signal=6

Sep 30 16:37:17 srv860 varnishd[16195]: Child (16196) Panic message: Assert error in WS_Release(), cache_ws.c line 193:   Condition(bytes <= ws->e - ws->f) not true. errno = 104 (Connection reset by peer) thread = (cache-worker) ident = Linux,2.6.18-194.el5,x86_64,-smalloc,-hcritbit,epoll Backtrace:   0x422616: /usr/sbin/varnishd [0x422616]   0x42d475: /usr/sbin/varnishd(WS_Release+0xf5) [0x42d475]   0x427b33: /usr/sbin/varnishd [0x427b33]   0x42bc45: /usr/sbin/varnishd(VRT_SetHdr+0xf5) [0x42bc45]   0x2aaaab003e76: ./vcl.1P9zoqAU.so [0x2aaaab003e76]   0x427006: /usr/sbin/varnishd(VCL_deliver_method+0x46) [0x427006]   0x4130cf: /usr/sbin/varnishd [0x4130cf]   0x413e49: /usr/sbin/varnishd(CNT_Session+0x369) [0x413e49]   0x424a68: /usr/sbin/varnishd [0x424a68]   0x423d4d: /usr/sbin/varnishd [0x423d4d] sp = 0x2aaac060e008 {   fd = 351, id = 351, xid = 1104824170,   client = 63.240.230.197:26479,   step = STP_DELIVER,   handling = deliver,   restarts = 0, esis = 0   ws = 0x2aaac060e078 {      id = "sess",     {s,f

Sep 30 16:37:17 srv860 varnishd[16195]: child (32562) Started

Sep 30 16:37:17 srv860 varnishd[16195]: Child (32562) said

Sep 30 16:37:17 srv860 varnishd[16195]: Child (32562) said Child starts


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100930/1f45e856/attachment-0003.html>


More information about the varnish-misc mailing list