MINOR: mworker: display an alert upon a wait-mode exit
When the mworker wait mode fails it does an exit, but there is no
error message which says it exits.
Add a message which specify that the error is non-recoverable.
Could be backported in 2.7 and possibly earlier branch.
diff --git a/src/haproxy.c b/src/haproxy.c
index 6076e02..0725261 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -877,6 +877,17 @@
mworker_reexec_waitmode();
}
+/*
+ * Exit with an error message upon a wait-mode failure.
+ */
+void exit_on_waitmode_failure()
+{
+ if (!atexit_flag)
+ return;
+
+ ha_alert("Non-recoverable mworker wait-mode error, exiting.\n");
+}
+
/*
* upon SIGUSR1, let's have a soft stop. Note that soft_stop() broadcasts
@@ -1970,10 +1981,17 @@
global.mode &= ~MODE_MWORKER;
}
- if ((global.mode & (MODE_MWORKER | MODE_CHECK | MODE_CHECK_CONDITION)) == MODE_MWORKER &&
- (getenv("HAPROXY_MWORKER_REEXEC") != NULL)) {
- atexit_flag = 1;
- atexit(reexec_on_failure);
+ /* set the atexit functions when not doing configuration check */
+ if (!(global.mode & (MODE_CHECK | MODE_CHECK_CONDITION))
+ && (getenv("HAPROXY_MWORKER_REEXEC") != NULL)) {
+
+ if (global.mode & MODE_MWORKER) {
+ atexit_flag = 1;
+ atexit(reexec_on_failure);
+ } else if (global.mode & MODE_MWORKER_WAIT) {
+ atexit_flag = 1;
+ atexit(exit_on_waitmode_failure);
+ }
}
if (change_dir && chdir(change_dir) < 0) {