[Varnish] #1700: objecthead counter incorrect or leaking on purge

Varnish varnish-bugs at varnish-cache.org
Thu Apr 9 21:27:20 CEST 2015


#1700: objecthead counter incorrect or leaking on purge
----------------------+--------------------
 Reporter:  dward84   |       Owner:
     Type:  defect    |      Status:  new
 Priority:  normal    |   Milestone:
Component:  varnishd  |     Version:  4.0.3
 Severity:  normal    |  Resolution:
 Keywords:            |
----------------------+--------------------

Comment (by dward84):

 I believe I found the issue:

 in the file bin/varnishd/hash/hash_critbit.c at function hcb_deref(),
 shouldn't it be setting the return value to 0 if the reference count is 0?

 {{{
 static int __match_proto__(hash_deref_f)
 hcb_deref(struct objhead *oh)
 {
         int r;

         r = 1;
         CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
         Lck_Lock(&oh->mtx);
         assert(oh->refcnt > 0);
         oh->refcnt--;
         if (oh->refcnt == 0) {
                 Lck_Lock(&hcb_mtx);
                 hcb_delete(&hcb_root, oh);
                 VTAILQ_INSERT_TAIL(&cool_h, oh, hoh_list);
                 Lck_Unlock(&hcb_mtx);
                 assert(VTAILQ_EMPTY(&oh->objcs));
                 AZ(oh->waitinglist);
         }
         Lck_Unlock(&oh->mtx);
 #ifdef PHK
         fprintf(stderr, "hcb_defef %d %d <%s>\n", __LINE__, r, oh->hash);
 #endif
         return (r);
 }
 }}}

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1700#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator



More information about the varnish-bugs mailing list