[master] 36c5d3a Deref the old object after finishing with it in cnt_miss()
Martin Blix Grydeland
martin at varnish-software.com
Mon May 12 10:56:45 CEST 2014
commit 36c5d3a7daee2a4088f9408ad92e3eb9c4468463
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Thu May 8 17:43:38 2014 +0200
Deref the old object after finishing with it in cnt_miss()
Fixes: #1499
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index fea943e..d60c136 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -498,6 +498,8 @@ cnt_miss(struct worker *wrk, struct req *req)
wrk->stats.cache_miss++;
VBF_Fetch(wrk, req, req->objcore, o, VBF_NORMAL);
req->req_step = R_STP_FETCH;
+ if (o != NULL)
+ (void)HSH_DerefObj(&wrk->stats, &o);
return (REQ_FSM_MORE);
case VCL_RET_SYNTH:
req->req_step = R_STP_SYNTH;
diff --git a/bin/varnishtest/tests/r01499.vtc b/bin/varnishtest/tests/r01499.vtc
new file mode 100644
index 0000000..7b438b2
--- /dev/null
+++ b/bin/varnishtest/tests/r01499.vtc
@@ -0,0 +1,32 @@
+varnishtest "#1499 - objcore ref leak on IMS update"
+
+server s1 {
+ rxreq
+ txresp -hdr "Etag: foo"
+ rxreq
+ expect req.http.if-none-match == "foo"
+ txresp -hdr "X-Resp: 2"
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_backend_response {
+ set beresp.ttl = 0.0001s;
+ set beresp.grace = 0s;
+ set beresp.keep = 2s;
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+
+ delay 0.5
+
+ txreq
+ rxresp
+ expect resp.http.x-resp == "2"
+} -run
+
+delay 3
+
+varnish v1 -expect n_object == 0
More information about the varnish-commit
mailing list