[master] bacec6a invalidate the cli_fd of dead varnishds

Nils Goroll nils.goroll at uplex.de
Tue May 17 14:45:09 CEST 2016


commit bacec6ac3eddaa171374246a0494d4000f03f83c
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue May 17 14:38:04 2016 +0200

    invalidate the cli_fd of dead varnishds
    
    In particular, this avoids a later backend.list attempt on a file descriptor
    to a dead process and, consequently, avoids a long delay in varnishtest
    when varnishd cant be started (for instance, because it is not in PATH).

diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 794f615..d486b01 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -471,18 +471,26 @@ varnish_launch(struct varnish *v)
 	    i, fd[0].revents, fd[1].revents);
 	if (i == 0) {
 		vtc_log(v->vl, 0, "FAIL timeout waiting for CLI connection");
+		AZ(close(v->cli_fd));
+		v->cli_fd = -1;
 		return;
 	}
 	if (fd[1].revents & POLLHUP) {
 		vtc_log(v->vl, 0, "FAIL debug pipe closed");
+		AZ(close(v->cli_fd));
+		v->cli_fd = -1;
 		return;
 	}
 	if (!(fd[0].revents & POLLIN)) {
 		vtc_log(v->vl, 0, "FAIL CLI connection wait failure");
+		AZ(close(v->cli_fd));
+		v->cli_fd = -1;
 		return;
 	}
 	nfd = accept(v->cli_fd, NULL, NULL);
 	if (nfd < 0) {
+		AZ(close(v->cli_fd));
+		v->cli_fd = -1;
 		vtc_log(v->vl, 0, "FAIL no CLI connection accepted");
 		return;
 	}



More information about the varnish-commit mailing list