[4.0] 62b5e3f Close piped sessions in the absence of backends

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Mar 31 16:14:03 CEST 2016


commit 62b5e3f410eb52943d0f42a8240bc28019b68bb1
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Feb 22 17:23:44 2016 +0100

    Close piped sessions in the absence of backends
    
    Fixes #1815

diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c
index 36ef425..6507121 100644
--- a/bin/varnishd/cache/cache_pipe.c
+++ b/bin/varnishd/cache/cache_pipe.c
@@ -113,6 +113,13 @@ PipeRequest(struct req *req, struct busyobj *bo)
 	acct_pipe.req = req->acct.req_hdrbytes;
 	req->acct.req_hdrbytes = 0;
 
+	if (bo->director == NULL) {
+		VSLb(bo->vsl, SLT_FetchError, "No backend");
+		pipecharge(req, &acct_pipe, NULL);
+		SES_Close(req->sp, SC_OVERLOAD);
+		return;
+	}
+
 	vc = VDI_GetFd(bo);
 	if (vc == NULL) {
 		VSLb(bo->vsl, SLT_FetchError, "no backend connection");
diff --git a/bin/varnishtest/tests/r01815.vtc b/bin/varnishtest/tests/r01815.vtc
new file mode 100644
index 0000000..667f3a5
--- /dev/null
+++ b/bin/varnishtest/tests/r01815.vtc
@@ -0,0 +1,19 @@
+varnishtest "backend unreachable on piped request"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	import ${vmod_debug};
+
+	sub vcl_recv {
+		set req.backend_hint = debug.no_backend();
+	}
+} -start
+
+client c1 {
+	txreq -req PROPFIND
+	expect_close
+} -run



More information about the varnish-commit mailing list