[master] c2a3f93 Always slim private & pass objects after delivery.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Nov 24 15:29:24 CET 2015
commit c2a3f93d1af81fe89966fce28a752cc8dc078704
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 24 14:28:59 2015 +0000
Always slim private & pass objects after delivery.
Fixes: #1821
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index f30ab59..c493e02 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -209,19 +209,20 @@ cnt_deliver(struct worker *wrk, struct req *req)
cnt_vdp(req, bo);
- if (bo != NULL)
- VBO_DerefBusyObj(wrk, &bo);
-
VSLb_ts_req(req, "Resp", W_TIM_real(wrk));
if (http_HdrIs(req->resp, H_Connection, "close"))
req->doclose = SC_RESP_CLOSE;
- if ((req->objcore->flags & OC_F_PASS) && bo != NULL) {
- VBO_waitstate(bo, BOS_FINISHED);
+ if (req->objcore->flags & (OC_F_PRIVATE | OC_F_PASS)) {
+ if (bo != NULL)
+ VBO_waitstate(bo, BOS_FINISHED);
ObjSlim(wrk, req->objcore);
}
+ if (bo != NULL)
+ VBO_DerefBusyObj(wrk, &bo);
+
(void)HSH_DerefObjCore(wrk, &req->objcore);
http_Teardown(req->resp);
return (REQ_FSM_DONE);
diff --git a/bin/varnishtest/tests/r01821.vtc b/bin/varnishtest/tests/r01821.vtc
new file mode 100644
index 0000000..1c8fa87
--- /dev/null
+++ b/bin/varnishtest/tests/r01821.vtc
@@ -0,0 +1,28 @@
+varnishtest "Slim down hit-for-pass objects"
+
+server s1 -repeat 2 {
+ rxreq
+ txresp -hdr "Cache-Control: max-age=5" -bodylen 65535
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_backend_response {
+ set beresp.uncacheable = true;
+ }
+} -start
+
+logexpect l1 -v v1 {
+ expect * * Storage Transient
+} -start
+
+client c1 {
+ txreq -url /foo
+ rxresp
+ txreq -url /bar
+ rxresp
+} -run
+
+logexpect l1 -wait
+
+varnish v1 -expect SMA.Transient.c_bytes != 0
+varnish v1 -expect SMA.Transient.g_bytes < 65536
More information about the varnish-commit
mailing list