BUG/MINOR: mworker: fix a FD leak of a sockpair upon a failed reload
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 28 Jan 2022 20:17:30 +0000 (21:17 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 16 Feb 2022 20:25:40 +0000 (21:25 +0100)
commit8e75b715cb990783931d35a3fec6bf6357a688d8
treeae71240b055e339498a6e08787896c079e63c3bb
parent16b5687af872dd5570687271796f4356791edefb
BUG/MINOR: mworker: fix a FD leak of a sockpair upon a failed reload

When starting HAProxy in master-worker, the master pre-allocate a struct
mworker_proc and do a socketpair() before the configuration parsing. If
the configuration loading failed, the FD are never closed because they
aren't part of listener, they are not even in the fdtab.

This patch fixes the issue by cleaning the mworker_proc structure that
were not asssigned a process, and closing its FDs.

Must be backported as far as 2.0, the srv_drop() only frees the memory
and could be dropped since it's done before an exec().

(cherry picked from commit 55a921c9147c2d45621964428c86c5ceb9fd31d8)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
include/haproxy/mworker.h
src/haproxy.c
src/mworker.c