]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: threads: fix thread_release() at the end of the rendez-vous point
authorWilly Tarreau <w@1wt.eu>
Tue, 16 Oct 2018 14:11:56 +0000 (16:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Oct 2018 15:03:16 +0000 (17:03 +0200)
There is a bug in this function used to release other threads. It leaves
the current thread marked as harmless. If after this another thread does
a thread_isolate(), but before the first one reaches poll(), the second
thread will believe it's alone while it's not.

This must be backported to 1.8 since the rendez-vous point was merged
into 1.8.14.

src/hathreads.c

index 2ee31de696ae2f512253baecbf8b0149612b2a6e..075866a609620a8278898a4b0827515bb9f9e544 100644 (file)
@@ -88,12 +88,8 @@ void thread_isolate()
  */
 void thread_release()
 {
-       while (1) {
-               HA_ATOMIC_AND(&threads_want_rdv_mask, ~tid_bit);
-               if (!(threads_want_rdv_mask & all_threads_mask))
-                       break;
-               thread_harmless_till_end();
-       }
+       HA_ATOMIC_AND(&threads_want_rdv_mask, ~tid_bit);
+       thread_harmless_end();
 }
 
 __attribute__((constructor))