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

Varnish varnish-bugs at varnish-cache.org
Tue Apr 7 22:59:07 CEST 2015


#1700: objecthead counter incorrect or leaking on purge
---------------------+----------------------
 Reporter:  dward84  |       Type:  defect
   Status:  new      |   Priority:  normal
Milestone:           |  Component:  varnishd
  Version:  4.0.3    |   Severity:  normal
 Keywords:           |
---------------------+----------------------
 When purging an item in varnish, I would expect the objecthead counter to
 be 0 (or 1?). But in practice, varnish appears to be creating a new
 objecthead for each replacement of the cache item.

 I suspect that this is an accounting error and not an actual leak as the
 memory usage does not appear to be increasing.

 See the following test:

 {{{
 varnishtest "objecthead leak on purge"

 server s1 {
     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"

     rxreq
     txresp -body "this is a test"
 } -start

 varnish v1 -arg "-s malloc,1M" \
            -vcl+backend {

     sub vcl_recv {
         if (req.method == "PURGE") {
             return(purge);
         }
     }

     sub vcl_purge {
         return(synth(200, "Purged."));
     }

     sub vcl_backend_response {
         set beresp.ttl = 1m;
         set beresp.grace = 0s;
         set beresp.keep = 0s;
     }
 } -start

 client c1 {
     txreq -url "/"
     rxresp

     txreq -req PURGE -url "/"
     rxresp
     expect resp.body ~ "Purged"

     txreq -url "/"
     rxresp

     txreq -req PURGE -url "/"
     rxresp
     expect resp.body ~ "Purged"

     txreq -url "/"
     rxresp

     txreq -req PURGE -url "/"
     rxresp
     expect resp.body ~ "Purged"

     txreq -url "/"
     rxresp

     txreq -req PURGE -url "/"
     rxresp
     expect resp.body ~ "Purged"

 } -run

 varnish v1 -expect MAIN.n_objecthead == 1
 }}}

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



More information about the varnish-bugs mailing list