[master] 6944fe82c respect max_restarts and fix c00028.vtc
Nils Goroll
nils.goroll at uplex.de
Tue Apr 23 12:57:07 UTC 2019
commit 6944fe82c8df4a26bf9f2006dda80a9e9566fb32
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sun Mar 17 12:25:47 2019 +0100
respect max_restarts and fix c00028.vtc
Fixes #2949
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index eb797917d..5a7ef97e3 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -272,6 +272,10 @@ cnt_synth(struct worker *wrk, struct req *req)
return (REQ_FSM_DONE);
}
+ if (wrk->handling == VCL_RET_RESTART &&
+ req->restarts > cache_param->max_restarts)
+ wrk->handling = VCL_RET_DELIVER;
+
if (wrk->handling == VCL_RET_RESTART) {
/*
* XXX: Should we reset req->doclose = SC_VCL_FAILURE
diff --git a/bin/varnishtest/tests/c00028.vtc b/bin/varnishtest/tests/c00028.vtc
index 0399e9fdc..7862e89e6 100644
--- a/bin/varnishtest/tests/c00028.vtc
+++ b/bin/varnishtest/tests/c00028.vtc
@@ -8,7 +8,11 @@ varnish v1 -vcl {
sub vcl_backend_fetch {
set bereq.backend = bad;
}
+ sub vcl_backend_error {
+ return (abandon);
+ }
sub vcl_synth {
+ set resp.http.restarts = req.restarts;
return (restart);
}
} -start
@@ -17,4 +21,5 @@ client c1 {
txreq -url "/"
rxresp
expect resp.status == 503
+ expect resp.http.restarts == 5
} -run
More information about the varnish-commit
mailing list