]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: mworker: set a timeout on the worker socketpair read at startup
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 13 Mar 2026 17:41:05 +0000 (18:41 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 13 Mar 2026 17:45:58 +0000 (18:45 +0100)
commit51d6f1ca4f75c18f9a6ad8e18adc4c1f336d5fa6
treec80cee76ea8acee30e3b6890293b0cf7ecba4eea
parentcb51c8729d2abe7dda85a56c4fd95df8d8be82b9
BUG/MINOR: mworker: set a timeout on the worker socketpair read at startup

During a soft reload, a starting worker sends sock_pair[0] to the master
via send_fd_uxst(), then reads on sock_pair[1] waiting for the master to
acknowledge receipt. Because of a documented macOS sendmsg(2) bug, the
worker must keep sock_pair[0] open until the master confirms the fd was
received by the CLI applet. This means the read() on sock_pair[1] will
never return 0 (EOF), since the worker itself still holds a reference to
sock_pair[0]. The worker can only unblock when the master actively sends
a byte back. If the master crashes before doing so, the worker blocks
indefinitely in read().

Fix this by setting a 2-second SO_RCVTIMEO on sock_pair[1] before the
read(), so the worker can unblock and continue regardless of the master's
state.

This was introduced by d7f6819161c ("BUG/MEDIUM: mworker: fix startup
and reload on macOS").

This should be backported to 3.1 and later.
src/haproxy.c