From: Willy Tarreau Date: Mon, 29 Jun 2020 17:23:19 +0000 (+0200) Subject: BUG/MINOR: haproxy: don't wake already stopping threads on exit X-Git-Tag: v2.2-dev12~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=369a2efc27ee785a831aff23db8eb9b0d70c2e9d;p=thirdparty%2Fhaproxy.git BUG/MINOR: haproxy: don't wake already stopping threads on exit Commit d645574 ("MINOR: soft-stop: let the first stopper only signal other threads") introduced a minor mistake which is that when a stopping thread signals all other threads, it also signals itself. When single-threaded, the process constantly wakes up while waiting for last connections to exit. Let's reintroduce the lost mask to avoid this. No backport is needed, this is 2.2-dev only. --- diff --git a/src/haproxy.c b/src/haproxy.c index 802a88fbe6..c8c869a6fd 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2926,7 +2926,7 @@ void run_poll_loop() if (_HA_ATOMIC_OR(&stopping_thread_mask, tid_bit) == tid_bit) { /* notify all threads that stopping was just set */ for (i = 0; i < global.nbthread; i++) - if ((all_threads_mask >> i) & 1) + if (((all_threads_mask & ~stopping_thread_mask) >> i) & 1) wake_thread(i); } }