[master] e7efee0 Ensure the VCL warmup before touching the label
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Sep 19 20:37:07 UTC 2017
commit e7efee0f282b3dc6c02ab95d69f4ecdd1c57cb37
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Sep 19 21:31:39 2017 +0200
Ensure the VCL warmup before touching the label
Fixes #2433
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 27fd56a..61aae33 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -838,16 +838,23 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
vpt->name);
return;
}
+ }
+
+ if (mgt_vcl_setstate(cli, vpt, VCL_STATE_WARM))
+ return;
+ vpt->state = VCL_STATE_WARM; /* XXX: race with the poker? */
+
+ if (vpl != NULL) {
mgt_vcl_dep_del(VTAILQ_FIRST(&vpl->dfrom));
AN(VTAILQ_EMPTY(&vpl->dfrom));
} else {
vpl = mgt_vcl_add(av[2], VCL_STATE_LABEL);
}
+
AN(vpl);
vpl->warm = 1;
- vpt->state = VCL_STATE_WARM;
mgt_vcl_dep_add(vpl, vpt);
- (void)mgt_vcl_setstate(cli, vpt, VCL_STATE_WARM);
+
if (!MCH_Running())
return;
diff --git a/bin/varnishtest/tests/r02433.vtc b/bin/varnishtest/tests/r02433.vtc
new file mode 100644
index 0000000..6815687
--- /dev/null
+++ b/bin/varnishtest/tests/r02433.vtc
@@ -0,0 +1,23 @@
+varnishtest "label a cold vcl"
+
+server s1 { } -start
+
+varnish v1 -vcl+backend {
+ import debug; # can fail a VCL warmup
+
+ sub vcl_recv {
+ return (synth(200));
+ }
+} -start
+
+# a dummy vcl to freely use vcl1
+varnish v1 -vcl+backend { }
+
+# the magic parameter that fails a VCL warmup
+varnish v1 -cliok "param.set max_esi_depth 42"
+
+varnish v1 -cliok "vcl.state vcl1 cold"
+varnish v1 -clierr 300 "vcl.label label1 vcl1"
+
+# check that creating the label actually failed
+varnish v1 -clierr 106 "vcl.discard label1"
More information about the varnish-commit
mailing list