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.
This commit is contained in:
Willy Tarreau 2025-09-02 11:26:50 +02:00
parent ce57f11991
commit c128887b8e

View File

@ -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) {