MAJOR: mworker: exits the master on failure
This patch changes the behavior of the master during the exit of a
worker.
When a worker exits with an error code, for example in the case of a
segfault, all workers are now killed and the master leaves.
If you don't want this behavior you can use the option
"master-worker no-exit-on-failure".
diff --git a/src/cfgparse.c b/src/cfgparse.c
index f70eafb..e7e32cf 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -716,8 +716,8 @@
if (alertif_too_many_args(1, file, linenum, args, &err_code))
goto out;
if (*args[1]) {
- if (!strcmp(args[1], "exit-on-failure")) {
- global.tune.options |= GTUNE_EXIT_ONFAILURE;
+ if (!strcmp(args[1], "no-exit-on-failure")) {
+ global.tune.options |= GTUNE_NOEXIT_ONFAILURE;
} else {
ha_alert("parsing [%s:%d] : '%s' only supports 'exit-on-failure' option.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
diff --git a/src/haproxy.c b/src/haproxy.c
index faa46e0..891a021 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -759,7 +759,7 @@
if (current_child(exitpid)) {
ha_alert("Current worker %d left with exit code %d\n", exitpid, status);
if (status != 0 && status != 130 && status != 143
- && global.tune.options & GTUNE_EXIT_ONFAILURE) {
+ && !(global.tune.options & GTUNE_NOEXIT_ONFAILURE)) {
ha_alert("exit-on-failure: killing every workers with SIGTERM\n");
mworker_kill(SIGTERM);
}