[master] 3e72fdb Make the counter vsm_cooling act according to spec

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Thu Jun 16 15:07:07 CEST 2016


commit 3e72fdbbf673a7b4abeb4082c9b6b95ad730c3e9
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date:   Wed Jun 15 14:34:32 2016 +0200

    Make the counter vsm_cooling act according to spec
    
    The counter g_cooling variable is now decremented when memory from the
    cooling list is freed, making the counter vsm_cooling update
    accordingly.
    
    Fixes: #1984

diff --git a/bin/varnishd/common/common_vsm.c b/bin/varnishd/common/common_vsm.c
index c6af50d..860b32c 100644
--- a/bin/varnishd/common/common_vsm.c
+++ b/bin/varnishd/common/common_vsm.c
@@ -179,6 +179,7 @@ VSM_common_cleaner(struct vsm_sc *sc, struct VSC_C_main *stats)
 		if (vr->cool > now)
 			break;
 		VTAILQ_REMOVE(&sc->r_cooling, vr, list);
+		sc->g_cooling -= vr->len;
 		vsm_common_insert_free(sc, vr);
 	}
 	stats->vsm_free = sc->g_free;
diff --git a/bin/varnishtest/tests/r01984.vtc b/bin/varnishtest/tests/r01984.vtc
new file mode 100644
index 0000000..b8b4a12
--- /dev/null
+++ b/bin/varnishtest/tests/r01984.vtc
@@ -0,0 +1,18 @@
+varnishtest "g_cooldown counter test"
+
+server s1 {} -start
+varnish v1 -vcl+backend {} -start
+varnish v1 -cliok "param.set vsm_free_cooldown 10.0"
+
+# Load and use a new VCL, freeze the first
+varnish v1 -vcl+backend {}
+varnish v1 -cliok "vcl.state vcl1 cold"
+
+# the VSM_common_cleaner runs every 1.1 seconds.
+# Wait for it to update vsm_cooling
+delay 2
+varnish v1 -expect vsm_cooling > 0
+
+# Wait long enough for all the cooling vsm memory to be transfered to the free list:
+delay 12
+varnish v1 -expect vsm_cooling == 0



More information about the varnish-commit mailing list