]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: listener: make the master also keep workers' inherited FDs
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Nov 2020 17:38:05 +0000 (18:38 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Nov 2020 13:22:42 +0000 (14:22 +0100)
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.

src/sock.c

index d640190329f77ec74eb30949ef3e7a6b79f5c3ac..192559bfbf262fa7de2e89198d84cd23e417df96 100644 (file)
@@ -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;