The attached patch fixes #1724 and #1730.
A test is included for the latter.

I will commit them separately providing they are OK.

Yes / No / Maybe ?
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index a02a7d8..c555e05 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -110,7 +110,6 @@ vbe_dir_getfd(const struct director *d, struct busyobj *bo)
 	if (vc == NULL) {
 		// XXX: Per backend stats ?
 		VSC_C_main->backend_fail++;
-		VSLb(bo->vsl, SLT_FetchError, "no backend connection");
 		return (-1);
 	}
 
@@ -278,6 +277,10 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
 	CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
 
 	i = vbe_dir_getfd(d, bo);
+	if (i < 0) {
+		VSLb(bo->vsl, SLT_FetchError, "no backend connection");
+		return;
+	}
 	V1P_Process(req, bo, i);
 	vbe_dir_finish(d, bo->wrk, bo);
 }
diff --git a/bin/varnishtest/tests/r01730.vtc b/bin/varnishtest/tests/r01730.vtc
new file mode 100644
index 0000000..03a588f
--- /dev/null
+++ b/bin/varnishtest/tests/r01730.vtc
@@ -0,0 +1,15 @@
+varnishtest "Test connection error on pipe"
+
+varnish v1 -vcl {
+	backend default { .host = "${bad_ip}"; }
+	sub vcl_recv {
+		return (pipe);
+	}
+} -start
+
+client c1 {
+	txreq
+	expect_close
+} -run
+
+varnish v1 -expect sc_rx_timeout == 1
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
  • PATCH Federico Schwindt

Reply via email to