[Varnish] #195: Varnish crashes in RES_BuildHttp (cache_response.c)

Varnish varnish-bugs at projects.linpro.no
Fri Jan 11 16:16:43 CET 2008


#195: Varnish crashes in RES_BuildHttp (cache_response.c)
----------------------+-----------------------------------------------------
 Reporter:  anders    |       Owner:  phk                                              
     Type:  defect    |      Status:  new                                              
 Priority:  normal    |   Milestone:                                                   
Component:  varnishd  |     Version:  1.2                                              
 Severity:  normal    |    Keywords:  varnishd core dump RES_BuildHttp cache_response.c
----------------------+-----------------------------------------------------
 Varnish crashes with this error message:

 {{{
 Cache child died pid=83172 status=0x8b
 Clean child
 }}}

 I am running Varnish 1.2 branch up to date to commit 2337, on
 FreeBSD/amd64 6.3-RC2 (on Intel (EMT64) hardware).

 My VCL:

 {{{
 backend default {
              set backend.host = "192.168.110.1";
              set backend.port = "80";
         }
 acl purge {
         "192.168.100.1"/32;
 }

 sub vcl_recv {
         if (req.http.host ~ "^(bars.*.foo.no|bazcache.foo.no)$") {
                 if (req.request == "GET" || req.request == "HEAD") {
                         lookup;
                 } elsif (req.request ~ "^(PURGE|REPURGE)$") {
                         if (client.ip ~ purge) {
                                 if (req.request == "REPURGE") {
                                         purge_url(req.url);
                                         error 200 "Repurged.";
                                 } else {
                                         lookup;
                                 }
                         } else {
                                 error 405 "Not allowed.";
                         }
                 } else {
                         pipe;
                 }
         } else {
                 error 403 "Access denied. Contact cacheadmin at foo.no if you
 have problems.";
         }
 }

 sub vcl_miss {
         if (req.request ~ "^(PURGE|REPURGE)$") {
                 error 404 "Not in cache.";
         } else {
                 fetch;
         }
 }
 sub vcl_hit {
         if (req.request == "PURGE") {
                 set obj.ttl = 0s;
                 error 200 "Purged.";
         } else {
                 deliver;
         }
 }
 sub vcl_fetch {
         if (obj.status == 404 || obj.status == 503 || obj.status == 500) {
                 pass;
         }

         if (!obj.valid) {
                 error;
         }
         if (!obj.cacheable) {
                 pass;
         }

         if (obj.http.Cookie) {
                 remove obj.http.Cookie;
         }
         if (obj.http.Set-Cookie) {
                 remove obj.http.Set-Cookie;
         }
         insert;
 }
 sub vcl_hash {
         set req.hash += req.url;
         if (req.http.host ~ "^bars.*.foo.no$") {
                 set req.hash += "bars.foo.no";
         } else {
                 set req.hash += req.http.host;
         }
         hash;
 }
 }}}

 Backtrace:

 {{{
 (gdb) bt
 #0  0x000000000041ada6 in RES_BuildHttp (sp=0x8db4008) at
 cache_response.c:139
 #1  0x000000000040e668 in cnt_deliver (sp=0x8db4008) at cache_center.c:155
 #2  0x0000000000410bdd in CNT_Session (sp=0x8db4008) at steps.h:42
 #3  0x00000000004192b8 in wrk_do_one (w=0x7ffff2995ad0) at
 cache_pool.c:193
 #4  0x0000000000419793 in wrk_thread (priv=0x86d320) at cache_pool.c:246
 #5  0x000000080099355b in pthread_create () from /usr/lib/libthr.so.2
 #6  0x00007ffff2796000 in ?? ()
 Cannot access memory at address 0x7ffff2996000
 (gdb) frame 0
 #0  0x000000000041ada6 in RES_BuildHttp (sp=0x8db4008) at
 cache_response.c:139
 139             http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %.0f",
 (gdb) print sp
 $1 = (struct sess *) 0x8db4008
 (gdb) print *sp
 $2 = {magic = 741317722, fd = 654, id = 654, xid = 0, restarts = 0, wrk =
 0x0,
   sockaddrlen = 16, mysockaddrlen = 128, sockaddr = 0x8db4670,
   mysockaddr = 0x8db46f0, addr = 0x8db4770 "195.159.104.134",
   port = 0x8db4780 "12691", srcaddr = 0xcaabb00, doclose = 0x0,
   http = 0x8db41c8, http0 = 0x8db4410, ws = {{magic = 905626964,
       id = 0x4339f0 "sess", s = 0x8db4770 "195.159.104.134",
       f = 0x8db47a7 "ayers-2.5.js", r = 0x0, e = 0x8db6770 ""}},
   ws_ses = 0x8db4786 "", ws_req = 0x8db4a07 "", htc = {{magic =
 1041886673,
       fd = 654, ws = 0x8db4070, rxbuf = {b = 0x8db4786 "", e = 0x8db4786
 ""},
       pipeline = {b = 0x0, e = 0x0}}}, t_open = 1200059307.9467714,
   t_req = nan(0x8000000000000), t_resp = nan(0x8000000000000),
   t_end = 1200059307.9467714, step = STP_DONE, cur_method = 0, handling =
 128,
   wantbody = 0 '\0', err_code = 0, err_reason = 0x0, list = {vtqe_next =
 0x0,
     vtqe_prev = 0x0}, backend = 0x0, bereq = 0x0, obj = 0x0, vcl = 0x0,
   mem = 0x8db4000, workreq = {list = {vtqe_next = 0x8cf8158,
       vtqe_prev = 0x53ab90}, sess = 0x8db4008}, acct = {
     first = 1200059307.8567345, sess = 1, req = 1, pipe = 0, pass = 0,
     fetch = 0, hdrbytes = 177, bodybytes = 0}, nhashptr = 12, ihashptr =
 4,
   lhashptr = 60, hashptr = 0x8db4a08}
 }}}

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


More information about the varnish-bugs mailing list