]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: threads: fix the no-thread case after the change to the sync point
authorWilly Tarreau <w@1wt.eu>
Tue, 7 Aug 2018 08:07:15 +0000 (10:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Aug 2018 08:07:15 +0000 (10:07 +0200)
In commit 0c026f4 ("MINOR: threads: add more consistency between certain
variables in no-thread case"), we ensured that we don't have all_threads_mask
zeroed anymore. But one test was missed for the write() to the sync pipe.
This results in a situation where when running single-threaded, once a
server status changes, a wake-up message is written to the pipe and never
consumed, showing a 100% CPU usage.

No backport is needed.

src/hathreads.c

index 69dcab9dcde3332a4d19ee82836612eafbbdaf09..16284be14ef04c7cda0a6054a50eb6c83b501e5f 100644 (file)
@@ -70,7 +70,7 @@ void thread_sync_enable(void)
  */
 void thread_want_sync()
 {
-       if (all_threads_mask) {
+       if (all_threads_mask & (all_threads_mask - 1)) {
                if (threads_want_sync & tid_bit)
                        return;
                if (HA_ATOMIC_OR(&threads_want_sync, tid_bit) == tid_bit)