[master] f80c0a1 Move the reopening of listen sockets down to after handling the child exit.

Martin Blix Grydeland martin at varnish-software.com
Mon Mar 5 13:51:07 UTC 2018


commit f80c0a1e22419a9b195b0af5f6c31576040fc758
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Feb 28 11:30:02 2018 +0100

    Move the reopening of listen sockets down to after handling the child exit.
    
    This makes sure that any panic message from the child is handled and shown
    before continuing (or possibly failing).

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 0c8660c..032b387 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -492,17 +492,6 @@ mgt_reap_child(void)
 		fprintf(stderr, "WAIT 0x%jd\n", (intmax_t)r);
 	assert(r == child_pid);
 
-	/*
-	 * XXX exit mgr if we fail even with retries?
-	 * number of retries? interval?
-	 */
-	for (i = 0; i < 3; i++) {
-		if (MAC_reopen_sockets() == 0)
-			break;
-		/* error already logged */
-		(void)sleep(1);
-	}
-
 	VSB_printf(vsb, "Child (%jd) %s", (intmax_t)r,
 	    status ? "died" : "ended");
 	if (WIFEXITED(status) && WEXITSTATUS(status)) {
@@ -549,6 +538,17 @@ mgt_reap_child(void)
 
 	MGT_Complain(C_DEBUG, "Child cleanup complete");
 
+	/*
+	 * XXX exit mgr if we fail even with retries?
+	 * number of retries? interval?
+	 */
+	for (i = 0; i < 3; i++) {
+		if (MAC_reopen_sockets() == 0)
+			break;
+		/* error already logged */
+		(void)sleep(1);
+	}
+
 	if (child_state == CH_DIED && mgt_param.auto_restart)
 		mgt_launch_child(NULL);
 	else if (child_state == CH_DIED)


More information about the varnish-commit mailing list