[4.1] 72a6d1e Set the go-cold timer on newly loaded warm auto VCLs

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Wed Apr 5 12:03:05 CEST 2017


commit 72a6d1ecd68a0e8cbf5f8d484624993a12c5cf36
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Mar 22 10:59:54 2017 +0100

    Set the go-cold timer on newly loaded warm auto VCLs
    
    Newly loaded VCLs didn't get their go cold timer set even when they
    were set to auto, causing them to never go cold automatically.
    
    Fixes: #2270
    
    Conflicts:
    	bin/varnishd/mgt/mgt_vcl.c

diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 3801863..4c47730 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -216,6 +216,8 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
 
 	if (!mgt_cli_askchild(&status, &p, "vcl.load %s %s %d%s\n",
 	    vp->name, vp->fname, vp->warm, vp->state)) {
+		if (vp->warm && !strcmp(vp->state, "auto"))
+			vp->go_cold = VTIM_mono();
 		free(p);
 		return;
 	}
diff --git a/bin/varnishtest/tests/r02270.vtc b/bin/varnishtest/tests/r02270.vtc
new file mode 100644
index 0000000..8547ca5
--- /dev/null
+++ b/bin/varnishtest/tests/r02270.vtc
@@ -0,0 +1,19 @@
+varnishtest "Test that never used VCLs go cold automatically"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -arg "-p vcl_cooldown=1" -vcl+backend {
+} -start
+
+varnish v1 -expect VBE.vcl1.s1.happy >= 0
+
+varnish v1 -cliok {vcl.inline vcl2 "vcl 4.0; backend s1 {.host = \"${s1_addr}\"; .port = \"${s1_port}\"; }"}
+
+varnish v1 -expect VBE.vcl2.s1.happy >= 0
+
+delay 5
+
+varnish v1 -expect !VBE.vcl2.s1.happy



More information about the varnish-commit mailing list