r4204 - in trunk/varnish-cache/bin: varnishd varnishtest/tests
sky at projects.linpro.no
sky at projects.linpro.no
Wed Aug 19 04:15:07 CEST 2009
Author: sky
Date: 2009-08-19 04:15:06 +0200 (Wed, 19 Aug 2009)
New Revision: 4204
Added:
trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc
Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
Log:
it was possible to have infinite recursion between vcl_error returning restart and cnt_recv calling vcl_error when you had too many restarts
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-08-18 20:43:25 UTC (rev 4203)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-08-19 02:15:06 UTC (rev 4204)
@@ -350,13 +350,15 @@
http_StatusMessage(sp->err_code));
VCL_error_method(sp);
- if (sp->handling == VCL_RET_RESTART) {
+ if (sp->handling == VCL_RET_RESTART && sp->restarts < params->max_restarts) {
HSH_Drop(sp);
sp->director = NULL;
sp->restarts++;
sp->step = STP_RECV;
return (0);
- }
+ } else if (sp->handling == VCL_RET_RESTART)
+ sp->handling = VCL_RET_DELIVER;
+
/* We always close when we take this path */
sp->doclose = "error";
Added: trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc (rev 0)
+++ trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc 2009-08-19 02:15:06 UTC (rev 4204)
@@ -0,0 +1,24 @@
+# $Id$
+
+test "Test that we can't recurse restarts forever"
+
+varnish v1 -vcl {
+ backend bad {
+ .host = "127.0.0.1";
+ .port = "9090";
+ }
+
+ sub vcl_recv {
+ set req.backend = bad;
+ }
+ sub vcl_error {
+ restart;
+ }
+ } -start
+
+client c1 {
+ txreq -url "/"
+ rxresp
+ expect resp.status == 503
+} -run
+
More information about the varnish-commit
mailing list