From: Willy Tarreau Date: Tue, 3 Nov 2020 17:38:05 +0000 (+0100) Subject: BUG/MEDIUM: listener: make the master also keep workers' inherited FDs X-Git-Tag: v2.3.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22ccd5ebaf10318f73ef9b9f999feebce6bc1f7f;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: listener: make the master also keep workers' inherited FDs In commit 374e9af35 ("MEDIUM: listener: let do_unbind_listener() decide whether to close or not") it didn't appear necessary to have the master process keep open the workers' inherited FDs. But this is actually necessary to handle the reload on "bind fd@foo" situations, otherwise the FD may be reassigned and the new socket cannot be set up, sometimes causing "socket operation on non-socket" or other types of errors. William found that this was the cause for the consistent failures of the abns regtest, which already used to fail very often before this and was as such marked as broken. Interestingly I didn't have this issue with my test configs because the FD number I used was higher and within the range of other listening sockets. But this means that one of these wouldn't work as expected. No backport is needed, this was introduced as part of the listeners rework in 2.3. --- diff --git a/src/sock.c b/src/sock.c index d640190329..192559bfbf 100644 --- a/src/sock.c +++ b/src/sock.c @@ -212,6 +212,7 @@ void sock_unbind(struct receiver *rx) * - worker process unbinding from a worker's FD with socket transfer enabled => keep * - master process unbinding from a master's inherited FD => keep * - master process unbinding from a master's FD => close + * - master process unbinding from a worker's inherited FD => keep * - master process unbinding from a worker's FD => close * - worker process unbinding from a master's FD => close * - worker process unbinding from a worker's FD => close @@ -225,7 +226,6 @@ void sock_unbind(struct receiver *rx) return; if (!stopping && master && - rx->flags & RX_F_MWORKER && rx->flags & RX_F_INHERITED) return;