[master] 8f06d0f If vcl_hit{} returns fetch{} without a BUSY object, treat is as a pass, it will be anyway.

Poul-Henning Kamp phk at varnish-cache.org
Mon Sep 9 14:18:32 CEST 2013


commit 8f06d0f81741bd680eebdd0cc923206b642c0204
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 9 12:17:55 2013 +0000

    If vcl_hit{} returns fetch{} without a BUSY object, treat is as a
    pass, it will be anyway.
    
    Fixes #1335

diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index d5b8722..34b8138 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -426,7 +426,18 @@ cnt_lookup(struct worker *wrk, struct req *req)
 	case VCL_RET_FETCH:
 		(void)HSH_DerefObj(&wrk->stats, &req->obj);
 		req->objcore = boc;
-		req->req_step = R_STP_MISS;
+		if (req->objcore != NULL)
+			req->req_step = R_STP_MISS;
+		else {
+			/*
+			 * We don't have a busy object, so treat this
+			 * lige a pass
+			 */
+			VSLb(req->vsl, SLT_VCL_Error,
+			    "vcl_hit{} returns fetch without busy object."
+			    "  Doing pass.");
+			req->req_step = R_STP_PASS;
+		}
 		return (REQ_FSM_MORE);
 	case VCL_RET_RESTART:
 		req->req_step = R_STP_RESTART;
diff --git a/bin/varnishtest/tests/r01335.vtc b/bin/varnishtest/tests/r01335.vtc
new file mode 100644
index 0000000..8a34d5b
--- /dev/null
+++ b/bin/varnishtest/tests/r01335.vtc
@@ -0,0 +1,25 @@
+varnishtest "#1335 fetch without busy object"
+
+server s1 {
+	rxreq
+	txresp -bodylen 5
+	rxreq
+	txresp -bodylen 6
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_hit {
+		if (req.http.two == "2") {
+			return (fetch);
+		}
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+} -run
+client c1 {
+	txreq -hdr "two: 2"
+	rxresp
+} -run



More information about the varnish-commit mailing list