[Varnish] #169: Varnishd crashes with assert error in bes_ClosedFd

Varnish varnish-bugs at projects.linpro.no
Tue Oct 9 19:58:12 CEST 2007


#169: Varnishd crashes with assert error in bes_ClosedFd
----------------------+-----------------------------------------------------
 Reporter:  anders    |       Owner:  phk  
     Type:  defect    |      Status:  new  
 Priority:  normal    |   Milestone:       
Component:  varnishd  |     Version:  trunk
 Severity:  normal    |    Keywords:       
----------------------+-----------------------------------------------------
 I am running Varnish trunk (up to date to commit 2096) with vca_act set to
 vca_acceptors[1] to use polling instead of kqueue, due to recent kqueue
 problems discovered in ticket #162.

 After some time, Varnish crashed:

 {{{
 Child said (2, 882): <<Assert error in bes_ClosedFd(),
 cache_backend_simple.c line 282:
   Condition((close(vc->fd)) == 0) not true.
   errno = 57 (Invalid argument)
 Assert error in bes_ClosedFd(), cache_backend_simple.c line 282:
   Condition((close(vc->fd)) == 0) not true.
   errno = 22 (Invalid argument)
 }}}

 My VCL:

 {{{
 backend default {
              set backend.host = "192.168.0.3";
              set backend.port = "80";
         }
 acl purge {
         "192.168.0.4"/32;
 }
 sub vcl_recv {
         if ((req.http.host ~ "^(cache.finn.no|finn.no|www.finn.no)$") ||
 (req.http.host == "banner.finn.no" && req.url ~
 "^/(jsp2|finn/gojsp|daily|board|auximg/papirfly|finn/cacheable|crossdomain.xml)"))
 {
                 if (req.request == "GET" || req.request == "HEAD") {
                         lookup;
                 } elsif (req.request == "PURGE") {
                         if (!client.ip ~ purge) {
                                 error 405 "Not allowed.";
                         }
                         lookup;
                 } else {
                         pipe;
                 }
         } else {
                 error 403 "Access denied. Contact cacheadmin at finn.no if
 you have problems.";
         }
 }
 sub vcl_miss {
         if (req.request == "PURGE") {
                 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.ttl < 86400s) {
                 set obj.ttl = 604800s;
         }
         if (obj.http.Cookie) {
                 remove obj.http.Cookie;
         }
         if (obj.http.Set-Cookie) {
                 remove obj.http.Set-Cookie;
         }
         insert;
 }
 }}}

 The backtrace:

 {{{
 Program received signal SIGABRT, Aborted.
 [Switching to Thread 0xf02f400 (LWP 100556)]
 0x0000000800c080dc in thr_kill () from /lib/libc.so.6
 (gdb) bt
 #0  0x0000000800c080dc in thr_kill () from /lib/libc.so.6
 #1  0x000000080098d01c in raise () from /usr/lib/libthr.so.2
 #2  0x0000000800c8716d in abort () from /lib/libc.so.6
 #3  0x000000080066ab99 in lbv_assert (func=0x42ef79 "bes_ClosedFd",
     file=0x42ed80 "cache_backend_simple.c", line=282,
     cond=0x42efee "(close(vc->fd)) == 0", err=22) at assert.c:58
 #4  0x000000000040d51e in bes_ClosedFd (w=0x7fffce071ae0, vc=0x51fa900)
     at cache_backend_simple.c:282
 #5  0x00000000004097a0 in VBE_ClosedFd (w=0x7fffce071ae0, vc=0x51fa900)
     at cache_backend.c:291
 #6  0x000000000041215c in Fetch (sp=0x24ce008) at cache_fetch.c:385
 #7  0x000000000040e978 in cnt_fetch (sp=0x24ce008) at cache_center.c:301
 #8  0x000000000040fc3e in CNT_Session (sp=0x24ce008) at steps.h:40
 #9  0x0000000000417588 in wrk_do_one (w=0x7fffce071ae0) at
 cache_pool.c:193
 #10 0x0000000000417a48 in wrk_thread (priv=0x85b300) at cache_pool.c:245
 #11 0x000000080098f55b in pthread_create () from /usr/lib/libthr.so.2
 #12 0x0000000000000000 in ?? ()
 Error accessing memory address 0x7fffce072000: Bad address.
 (gdb) frame 4
 #4  0x000000000040d51e in bes_ClosedFd (w=0x7fffce071ae0, vc=0x51fa900)
     at cache_backend_simple.c:282
 282             AZ(close(vc->fd));
 (gdb) print vc->fd
 $1 = 479
 }}}

 PS: This was while the FreeBSD kernel seemed to be in a bit frozen state,
 with no/little response. Suddenly it loosened and I could log in. Then I
 could see this error.

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


More information about the varnish-bugs mailing list