[master] c2e16df Make the vtc subprocess a processgroup leader, and kill the entire process group on timeout.

Poul-Henning Kamp phk at FreeBSD.org
Wed Nov 8 12:27:05 UTC 2017


commit c2e16dfd694af880cb60b64b3951b6aa221e8778
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Nov 8 12:23:25 2017 +0000

    Make the vtc subprocess a processgroup leader, and kill the
    entire process group on timeout.
    
    This still leaves the case where the process group leader exits
    without a timeout but some of its subprocesses failed to stop.
    
    Relevant to: #2469

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 0fb3a9b..4df1af0 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -165,7 +165,7 @@ tst_cb(const struct vev *ve, int what)
 	// printf("CB %p %s %d\n", ve, jp->tst->filename, what);
 	if (what == 0) {
 		jp->killed = 1;
-		AZ(kill(jp->child, SIGKILL)); /* XXX: Timeout */
+		AZ(kill(-jp->child, SIGKILL)); /* XXX: Timeout */
 	} else {
 		assert(what & (EV_RD | EV_HUP));
 	}
@@ -298,6 +298,7 @@ start_test(void)
 	jp->child = fork();
 	assert(jp->child >= 0);
 	if (jp->child == 0) {
+		AZ(setpgrp(getpid(), 0));
 		VFIL_null_fd(STDIN_FILENO);
 		assert(dup2(p[1], STDOUT_FILENO) == STDOUT_FILENO);
 		assert(dup2(p[1], STDERR_FILENO) == STDERR_FILENO);


More information about the varnish-commit mailing list