mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-09 14:58:25 +00:00
BUG/MEDIUM: mworker: do not register an exit handler if exit is expected
The master-worker code registers an exit handler to deal with configuration issues during reload, leading to a restart of the master process in wait mode. But it shouldn't do that when it's expected that the program stops during config parsing or condition checks, as the reload operation is unexpectedly called and results in abnormal behavior and even crashes: $ HAPROXY_MWORKER_REEXEC=1 ./haproxy -W -c -f /dev/null Configuration file is valid [NOTICE] (18418) : haproxy version is 2.5-dev2-ee2420-6 [NOTICE] (18418) : path to executable is ./haproxy [WARNING] (18418) : config : Reexecuting Master process in waitpid mode Segmentation fault $ HAPROXY_MWORKER_REEXEC=1 ./haproxy -W -cc 1 [NOTICE] (18412) : haproxy version is 2.5-dev2-ee2420-6 [NOTICE] (18412) : path to executable is ./haproxy [WARNING] (18412) : config : Reexecuting Master process in waitpid mode [WARNING] (18412) : config : Reexecuting Master process Note that the presence of this variable happens by accident when haproxy is called from within its own programs (see issue #1324), but this should be the object of a separate fix. This patch fixes this by preventing the atexit registration in such situations. This should be backported as far as 1.8. MODE_CHECK_CONDITION has to be dropped for versions prior to 2.5.
This commit is contained in:
parent
dc70c18ddc
commit
26146194d3
@ -1772,7 +1772,8 @@ static void init(int argc, char **argv)
|
||||
global.mode &= ~MODE_MWORKER;
|
||||
}
|
||||
|
||||
if ((global.mode & MODE_MWORKER) && (getenv("HAPROXY_MWORKER_REEXEC") != NULL)) {
|
||||
if ((global.mode & (MODE_MWORKER | MODE_CHECK | MODE_CHECK_CONDITION)) == MODE_MWORKER &&
|
||||
(getenv("HAPROXY_MWORKER_REEXEC") != NULL)) {
|
||||
atexit_flag = 1;
|
||||
atexit(reexec_on_failure);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user