Skip to content

Commit c128887

Browse files
committed
BUG/MINOR: haproxy: be sure not to quit too early on soft stop
The fix in 4a9e3e1 ("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.
1 parent ce57f11 commit c128887

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/haproxy.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,11 @@ void run_poll_loop()
28582858
wake = 0;
28592859
}
28602860

2861-
if (!wake) {
2861+
/* Note below: threads only check the quit condition when idle,
2862+
* but for tid>0 we also need to skip that if the signal queue
2863+
* is non-empty otherwise we risk quitting too early.
2864+
*/
2865+
if (!wake && !signal_queue_len) {
28622866
int i;
28632867

28642868
if (stopping) {

0 commit comments

Comments
 (0)