Le 17/07/2018 à 19:39, PiBa-NL a écrit :
Hi Christopher,
Op 17-7-2018 om 10:09 schreef Christopher Faulet:
Could you try to revert the following commit please ?
* ba86c6c25 MINOR: threads: Be sure to remove threads from
all_threads_mask on exit
Without this specific commit the termination of the old process works
'properly'.
That is.. for testing i used 1.9 snapshot of 20180714 and included a
little patch to remove the 'atomic and'.. which is basically what that
commit added..
#ifdef USE_THREAD
- HA_ATOMIC_AND(&all_threads_mask, ~tid_bit);
if (tid > 0)
pthread_exit(NULL);
#endif
Also snapshot of 20180622 +
'0461-BUG-MEDIUM-threads-Use-the-sync-point-to-che-1.9-dev0.patch' works
okay.
Though i guess just reverting that line is not the right fix ;).
Hi,
Thanks Pieter. Sorry for the delay, I was busy on something else...
The bug is really in the sync point. Reverting the patch was just an
easy way to spot it. Here is the right fix. It should be backported in 1.8.
Thanks,
--
Christopher Faulet
>From 7da071dfe4cff3cc4cf7a195d4f5e056c7281803 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <[email protected]>
Date: Fri, 20 Jul 2018 09:31:53 +0200
Subject: [PATCH] BUG/MEDIUM: threads: Fix the exit condition of the thread
barrier
In thread_sync_barrier, we exit when all threads have set their own bit in the
barrier mask. It is done by comparing it to all_threads_mask. But we must not
use a simple equality to do so, becaue all_threads_mask may change. Since commit
ba86c6c25 ("MINOR: threads: Be sure to remove threads from all_threads_mask on
exit"), when a thread exit, its bit is removed from all_threads_mask. Instead,
we must use a bitwise AND to test is all bits of all_threads_mask are set.
This patch must be backported in 1.8.
---
src/hathreads.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hathreads.c b/src/hathreads.c
index 5db3c2197..19a787fb8 100644
--- a/src/hathreads.c
+++ b/src/hathreads.c
@@ -106,7 +106,7 @@ static inline void thread_sync_barrier(volatile unsigned long *barrier)
HA_ATOMIC_CAS(barrier, &old, 0);
HA_ATOMIC_OR(barrier, tid_bit);
- while (*barrier != all_threads_mask)
+ while ((*barrier & all_threads_mask) != all_threads_mask)
pl_cpu_relax();
}
--
2.17.1