[master] d2eb70177 vtc: defuse assertion while stopping

Nils Goroll nils.goroll at uplex.de
Mon Nov 8 09:40:08 UTC 2021


commit d2eb70177c11ef801a04c9cc3e68f219dfb6ee5e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Nov 8 10:31:39 2021 +0100

    vtc: defuse assertion while stopping
    
    The disconnect function should not complain when the server is already
    closed by an explicit close.
    
    Saw this failure in vtest:
    
    *    top   TEST ../../../../bin/varnishtest/tests/r01918.vtc starting
    ...
    **   s1    === txresp -nolen -bodylen 10
    **** s1    txresp|HTTP/1.1 200 OK\r
    **** s1    txresp|\r
    **** s1    txresp|!"#$%&'()
    **   s1    === close
    ...
    **   s1    Waiting for server (4/-1)
    **** s1    Closed
    ***  s1    shutting fd -1
    ---- s1    Shutdown failed: Bad file descriptor

diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index 77dcae8dc..23606a1ac 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -265,7 +265,7 @@ server_disc(void *priv, struct vtclog *vl, int *fdp)
 	CAST_OBJ_NOTNULL(s, priv, SERVER_MAGIC);
 	vtc_log(vl, 3, "shutting fd %d", *fdp);
 	j = shutdown(*fdp, SHUT_WR);
-	if (!VTCP_Check(j))
+	if (!vtc_stop && !VTCP_Check(j))
 		vtc_fatal(vl, "Shutdown failed: %s", strerror(errno));
 	VTCP_close(fdp);
 }


More information about the varnish-commit mailing list