[master] f0ea90986 vtc: Work around a leak report with h2 tests

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Aug 23 04:23:06 UTC 2021


commit f0ea90986c14d7769cb16acd41c8a32328a92891
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Aug 23 06:13:22 2021 +0200

    vtc: Work around a leak report with h2 tests
    
    This will hopefully silence our continuous integration complaining way
    too often about server leaking what http_process_cleanup() should take
    care of.

diff --git a/bin/varnishtest/tests/a02001.vtc b/bin/varnishtest/tests/a02001.vtc
index 332957982..eb0253983 100644
--- a/bin/varnishtest/tests/a02001.vtc
+++ b/bin/varnishtest/tests/a02001.vtc
@@ -94,3 +94,5 @@ client c1 -connect ${s1_sock} {
 		expect resp.body == "floubidoutata"
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02002.vtc b/bin/varnishtest/tests/a02002.vtc
index 0ebd23e67..2f6c504bd 100644
--- a/bin/varnishtest/tests/a02002.vtc
+++ b/bin/varnishtest/tests/a02002.vtc
@@ -18,3 +18,5 @@ client c1 -connect ${s1_sock} {
 		expect goaway.debug == "compression_error"
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02003.vtc b/bin/varnishtest/tests/a02003.vtc
index 6e0bb50b7..eced2da04 100644
--- a/bin/varnishtest/tests/a02003.vtc
+++ b/bin/varnishtest/tests/a02003.vtc
@@ -15,3 +15,5 @@ client c1 -connect ${s1_sock} {
 		expect resp.bodylen == 7
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02004.vtc b/bin/varnishtest/tests/a02004.vtc
index 992b8a194..915446080 100644
--- a/bin/varnishtest/tests/a02004.vtc
+++ b/bin/varnishtest/tests/a02004.vtc
@@ -14,3 +14,5 @@ client c1 -connect ${s1_sock} {
 		expect resp.bodylen == 3
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02011.vtc b/bin/varnishtest/tests/a02011.vtc
index 031bc4068..d4a7719e6 100644
--- a/bin/varnishtest/tests/a02011.vtc
+++ b/bin/varnishtest/tests/a02011.vtc
@@ -20,3 +20,5 @@ client c1  -connect ${s1_sock} {
 		expect resp.http.:status == 200
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02012.vtc b/bin/varnishtest/tests/a02012.vtc
index 76ad72de6..83960b8e8 100644
--- a/bin/varnishtest/tests/a02012.vtc
+++ b/bin/varnishtest/tests/a02012.vtc
@@ -54,3 +54,5 @@ client c1 -connect ${s1_sock} {
 		expect frame.padding == 6
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02014.vtc b/bin/varnishtest/tests/a02014.vtc
index 0dd7d71e1..b026e56b9 100644
--- a/bin/varnishtest/tests/a02014.vtc
+++ b/bin/varnishtest/tests/a02014.vtc
@@ -20,6 +20,7 @@ server s1 {
 		expect stream.dependency == 7
 	} -run
 } -start
+
 client c1 -connect ${s1_sock} {
 	stream 1 {
 		txreq -method GET -url /1 \
@@ -49,4 +50,5 @@ client c1 -connect ${s1_sock} {
 		expect stream.dependency == <undef>
 	} -run
 } -run
+
 server s1 -wait
diff --git a/bin/varnishtest/tests/a02015.vtc b/bin/varnishtest/tests/a02015.vtc
index 9af3a7a0d..e1f7b59d0 100644
--- a/bin/varnishtest/tests/a02015.vtc
+++ b/bin/varnishtest/tests/a02015.vtc
@@ -30,6 +30,7 @@ server s1 {
 	} -run
 
 } -start
+
 client c1 -connect ${s1_sock} {
 	stream 1 {
 		txreq
diff --git a/bin/varnishtest/tests/a02019.vtc b/bin/varnishtest/tests/a02019.vtc
index 712d93e3f..388b6e506 100644
--- a/bin/varnishtest/tests/a02019.vtc
+++ b/bin/varnishtest/tests/a02019.vtc
@@ -1,4 +1,5 @@
 varnishtest "Static table encoding"
+
 server s1 {
 	stream 1 {
 		rxreq
diff --git a/bin/varnishtest/tests/a02020.vtc b/bin/varnishtest/tests/a02020.vtc
index 5b0702ba1..38aba8755 100644
--- a/bin/varnishtest/tests/a02020.vtc
+++ b/bin/varnishtest/tests/a02020.vtc
@@ -39,3 +39,5 @@ client c1 -connect ${s1_sock} {
 	} -run
 
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02022.vtc b/bin/varnishtest/tests/a02022.vtc
index c089cd6a6..1be052e05 100644
--- a/bin/varnishtest/tests/a02022.vtc
+++ b/bin/varnishtest/tests/a02022.vtc
@@ -21,3 +21,5 @@ server s1 {
 } -start
 
 shell { nghttp http://${s1_sock} -nu }
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02025.vtc b/bin/varnishtest/tests/a02025.vtc
index b3088d4d9..396e29e6e 100644
--- a/bin/varnishtest/tests/a02025.vtc
+++ b/bin/varnishtest/tests/a02025.vtc
@@ -1,17 +1,21 @@
 varnishtest "Test -bodyfrom"
 
+shell {printf helloworld >body.txt}
+
 server s1 {
 	stream 1 {
 		rxreq
-		expect req.bodylen == 286
-		txresp -bodyfrom ${testdir}/a02025.vtc
+		expect req.body == helloworld
+		txresp -bodyfrom body.txt
 	} -run
 } -start
 
 client c1 -connect ${s1_sock} {
 	stream 1 {
-		txreq -bodyfrom ${testdir}/a02025.vtc
+		txreq -bodyfrom body.txt
 		rxresp
-		expect resp.bodylen == 286
+		expect resp.body == helloworld
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/tests/a02026.vtc b/bin/varnishtest/tests/a02026.vtc
index 71bcca94d..bf61aebc9 100644
--- a/bin/varnishtest/tests/a02026.vtc
+++ b/bin/varnishtest/tests/a02026.vtc
@@ -27,3 +27,5 @@ client c1 -connect ${s1_sock} {
 		expect resp.bodylen == 10
 	} -run
 } -run
+
+server s1 -wait
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 6e0c2846b..d4265f4c4 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1806,7 +1806,6 @@ http_process(struct vtclog *vl, struct vtc_sess *vsp, const char *spec,
 	hp->sess->fd = sock;
 	hp->timeout = vtc_maxdur * 1000 / 2;
 
-
 	if (rcvbuf) {
 		// XXX setsockopt() too late on SunOS
 		// https://github.com/varnishcache/varnish-cache/pull/2980#issuecomment-486214661
@@ -1853,6 +1852,12 @@ http_process(struct vtclog *vl, struct vtc_sess *vsp, const char *spec,
 		strcpy(hp->rem_port, "0");
 		hp->rem_path = strdup(addr);
 	}
+	/* XXX: After an upgrade to HTTP/2 the cleanup of a server that is
+	 * not -wait'ed before the test resets is subject to a race where the
+	 * cleanup does not happen, so ASAN reports leaks despite the push
+	 * of a cleanup handler. To easily reproduce, remove the server wait
+	 * from a02022.vtc and run with ASAN enabled.
+	 */
 	pthread_cleanup_push(http_process_cleanup, hp);
 	parse_string(vl, hp, spec);
 	retval = hp->sess->fd;


More information about the varnish-commit mailing list