[master] 6e8fad2 Exit the management process if we fail to reopen the listening sockets.

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


commit 6e8fad2c06db868ec8cbe27d2447c6a3c19d3418
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Feb 28 11:33:48 2018 +0100

    Exit the management process if we fail to reopen the listening sockets.
    
    As the code was, we would run into an assert immediately upon starting the
    child when we handed it a socket==-1. Better to exit with an error
    message.
    
    To keep running with a degraded set might catch people by surprise, so the
    only option left is to exit the process.

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index 032b387..88acd0e 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -538,16 +538,20 @@ mgt_reap_child(void)
 
 	MGT_Complain(C_DEBUG, "Child cleanup complete");
 
-	/*
-	 * XXX exit mgr if we fail even with retries?
-	 * number of retries? interval?
-	 */
+	/* XXX number of retries? interval? */
 	for (i = 0; i < 3; i++) {
 		if (MAC_reopen_sockets() == 0)
 			break;
 		/* error already logged */
 		(void)sleep(1);
 	}
+	if (i == 3) {
+		/* We failed to reopen our listening sockets. No choice
+		 * but to exit. */
+		MGT_Complain(C_ERR,
+		    "Could not reopen listening sockets. Exiting.");
+		exit(1);
+	}
 
 	if (child_state == CH_DIED && mgt_param.auto_restart)
 		mgt_launch_child(NULL);


More information about the varnish-commit mailing list