mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MEDIUM: mworker: block SIGCHLD until the master is ready
With the new way of handling the signals in the master worker, we are are not staying in a waitpid() loop. Which means that we need to catch the SIGCHLD signals to call waitpid(). The problem is when the master is reloading, this signal is neither registered nor blocked so we lost all signals between the restart and the call to mworker_loop(). This patch blocks the SIGCHLD signals before the reloading and ensure it's not unblocked before the master registered the SIGCHLD handler.
This commit is contained in:
parent
91c13b696a
commit
ebf304f8dd
@ -493,6 +493,7 @@ static void mworker_block_signals()
|
||||
sigaddset(&set, SIGHUP);
|
||||
sigaddset(&set, SIGINT);
|
||||
sigaddset(&set, SIGTERM);
|
||||
sigaddset(&set, SIGCHLD);
|
||||
ha_sigmask(SIG_SETMASK, &set, NULL);
|
||||
}
|
||||
|
||||
@ -506,6 +507,7 @@ static void mworker_unblock_signals()
|
||||
sigaddset(&set, SIGHUP);
|
||||
sigaddset(&set, SIGINT);
|
||||
sigaddset(&set, SIGTERM);
|
||||
sigaddset(&set, SIGCHLD);
|
||||
ha_sigmask(SIG_UNBLOCK, &set, NULL);
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,8 @@ int signal_init()
|
||||
* parsing We don't want the process to be killed by an unregistered
|
||||
* USR2 signal when the master-worker is reloading */
|
||||
sigaddset(&blocked_sig, SIGUSR2);
|
||||
sigaddset(&blocked_sig, SIGCHLD);
|
||||
|
||||
ha_sigmask(SIG_SETMASK, &blocked_sig, NULL);
|
||||
|
||||
sigfillset(&blocked_sig);
|
||||
|
Loading…
x
Reference in New Issue
Block a user