]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: Be sure to remove threads from all_threads_mask on exit
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Jun 2018 07:57:39 +0000 (09:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Jun 2018 12:55:15 +0000 (14:55 +0200)
When HAProxy is started with several threads, Each running thread holds a bit in
the bitfiled all_threads_mask. This bitfield is used here and there to check
which threads are registered to take part in a specific processing. So when a
thread exits, it seems normal to remove it from all_threads_mask.

No direct impact could be identified with this right now but it would
be better to backport it to 1.8 as a preventive measure to avoid complex
situations like the one in previous bug.

src/haproxy.c

index 5906f798923129af8c5a42b09525e36d6deb06ae..11d1d47ceb41b01c793fd81771429912aaac5de3 100644 (file)
@@ -2473,6 +2473,8 @@ static void *run_thread_poll_loop(void *data)
        list_for_each_entry(ptdf, &per_thread_deinit_list, list)
                ptdf->fct();
 
+       HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
+
 #ifdef USE_THREAD
        if (tid > 0)
                pthread_exit(NULL);