BUG/MEDIUM: mworker: don't use _getsocks in wait mode
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 7 Jan 2022 17:19:42 +0000 (18:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Jan 2022 16:28:49 +0000 (17:28 +0100)
commitadd2fc5f33534049bec0fe769c8ac0f5bcc26c5d
treea8beb6a4b4d202083cf3cf312cbafce13f7422e4
parentfc8ff21d0cca5b316f3821a7f8588db28896e04b
BUG/MEDIUM: mworker: don't use _getsocks in wait mode

Since version 2.5 the master is automatically re-executed in wait-mode
when the config is successfully loaded, puting corner cases of the wait
mode in plain sight.

When using the -x argument and with the right timing, the master will
try to get the FDs again in wait mode even through it's not needed
anymore, which will harm the worker by removing its listeners.

However, if it fails, (and it's suppose to, sometimes), the
master will exit with EXIT_FAILURE because it does not have the
MODE_MWORKER flag, but only the MODE_MWORKER_WAIT flag. With the
consequence of killing the workers.

This patch fixes the issue by restricting the use of _getsocks to some
modes.

This patch must be backported in every version supported, even through
the impact should me more harmless in version prior to 2.5.

(cherry picked from commit f82afbb9cd1515e9fa7f9e6df84904b832226304)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
(cherry picked from commit 9e1927c7e20af70b891eaaa9f88b0dc9d7b570e5)
[cf: MODE_CHECK_CONDITION flag removed]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 9993c17d30f5c65782f36d18df69eded777963bb)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/haproxy.c