From c128887b8ef1a9b010b5de6cef2879f1d8bc204c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 2 Sep 2025 11:26:50 +0200 Subject: [PATCH] BUG/MINOR: haproxy: be sure not to quit too early on soft stop The fix in 4a9e3e102e ("BUG/MINOR: haproxy: only tid 0 must not sleep if got signal") had the nasty side effect of breaking the graceful reload operations: threads whose id is non-zero could quit too early and not process incoming traffic, which is visible with broken connections during reloads. They just need to ignore the the stopping condition until the signal queue is empty. In any case, it's the thread in charge of the signal queue which will notify them once it receives the signal. It was verified that connections are no longer broken with this fix, and that the issue that required it (#2537, looping threads on reload) does not re-appear with the reproducer, while it still did without the fix above. Since the fix above was backported to every stable version, this one will also have to. --- src/haproxy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 4641533cb..5d06c286b 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2858,7 +2858,11 @@ void run_poll_loop() wake = 0; } - if (!wake) { + /* Note below: threads only check the quit condition when idle, + * but for tid>0 we also need to skip that if the signal queue + * is non-empty otherwise we risk quitting too early. + */ + if (!wake && !signal_queue_len) { int i; if (stopping) {