[experimental-ims] eab8652 restart in vcl_deliver{} would crash in vcl_fetch{} due to missing cleanup.

Geoff Simmons geoff at varnish-cache.org
Wed Aug 31 16:02:21 CEST 2011


commit eab8652f3f2c29275aa2236e5c967d0d1d07de24
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 17 07:15:30 2011 +0000

    restart in vcl_deliver{} would crash in vcl_fetch{} due to missing cleanup.
    
    Found & Fixed by:	Martin
    
    Fixes	#979

diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 672e1dc..47f3720 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -233,6 +233,7 @@ cnt_prepresp(struct sess *sp)
 		AZ(sp->obj);
 		sp->restarts++;
 		sp->director = NULL;
+		sp->wrk->h_content_length = NULL;
 		http_Setup(sp->wrk->bereq, NULL);
 		http_Setup(sp->wrk->beresp, NULL);
 		http_Setup(sp->wrk->resp, NULL);
diff --git a/bin/varnishtest/tests/r00979.vtc b/bin/varnishtest/tests/r00979.vtc
new file mode 100644
index 0000000..bc72efc
--- /dev/null
+++ b/bin/varnishtest/tests/r00979.vtc
@@ -0,0 +1,29 @@
+varnishtest "r00979.vtc Test restart when do_stream in vcl_deliver"
+
+server s1 {
+	rxreq
+	txresp -status 200 -body "1"
+	expect_close
+
+	accept
+	rxreq
+	txresp -status 200 -body "11"
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_fetch {
+		set beresp.do_stream = true;
+	}
+	sub vcl_deliver {
+		if (req.restarts == 0) {
+			return (restart);
+		}
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+	expect resp.bodylen == 2
+} -run



More information about the varnish-commit mailing list