[master] eaeac2062 fix vcl temperature after failing warmup event

Nils Goroll nils.goroll at uplex.de
Sat Nov 17 14:08:13 UTC 2018


commit eaeac20620384802478b8f4fba41e13697a0b3ca
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat Nov 17 15:06:41 2018 +0100

    fix vcl temperature after failing warmup event
    
    Fixes #2835

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 02af16289..fd9deade4 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -507,10 +507,12 @@ vcl_set_state(VRT_CTX, const char *state)
 		else {
 			vcl->temp = VCL_TEMP_WARM;
 			i = vcl_send_event(ctx, VCL_EVENT_WARM);
-			if (i == 0)
+			if (i == 0) {
 				vcl_BackendEvent(vcl, VCL_EVENT_WARM);
-			else
-				AZ(vcl->conf->event_vcl(ctx, VCL_EVENT_COLD));
+				break;
+			}
+			AZ(vcl->conf->event_vcl(ctx, VCL_EVENT_COLD));
+			vcl->temp = VCL_TEMP_COLD;
 		}
 		break;
 	default:
diff --git a/bin/varnishtest/tests/v00003.vtc b/bin/varnishtest/tests/v00003.vtc
index ff218f28c..6236f28f1 100644
--- a/bin/varnishtest/tests/v00003.vtc
+++ b/bin/varnishtest/tests/v00003.vtc
@@ -88,6 +88,8 @@ varnish v1 -expect !VBE.vcl1.default.happy
 varnish v1 -cliok "param.set max_esi_depth 42"
 varnish v1 -clierr 300 "vcl.state vcl1 warm"
 
+varnish v1 -cliexpect "available *cold/cold *[0-9]+ *vcl1\\s+active *warm/warm *[0-9]+ *vcl2" "vcl.list"
+
 # A warm-up failure can also fail a child start
 varnish v1 -cliok stop
 varnish v1 -cliok "vcl.state vcl1 warm"


More information about the varnish-commit mailing list