[master] 7480dff Assert that the thread-workspace is empty on state transitions. We want to keep it light and small, so we forbid any long-term usage an detect leakage with this assert.

Poul-Henning Kamp phk at varnish-cache.org
Thu Oct 18 12:39:53 CEST 2012


commit 7480dff735bba2fa82cd71f3de4a1cd1d7eff77f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 18 10:39:07 2012 +0000

    Assert that the thread-workspace is empty on state transitions.  We want
    to keep it light and small, so we forbid any long-term usage an detect
    leakage with this assert.

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 9f996c3..edd986c 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -1205,9 +1205,16 @@ CNT_Request(struct worker *wrk, struct req *req)
 		 */
 		CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 		CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
-		WS_Assert(wrk->aws);
 		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
+		/*
+		 * We don't want the thread workspace to be used for
+		 * anything of long duration, so mandate that it be
+		 * empty on state-transitions.
+		 */
+		WS_Assert(wrk->aws);
+		assert(wrk->aws->s == wrk->aws->f);
+
 		switch (req->req_step) {
 #define REQ_STEP(l,u,arg) \
 		    case R_STP_##u: \



More information about the varnish-commit mailing list