From 291f6ff885e4143b592a0cf8312d621bd8b3e1dd Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 4 Jul 2022 13:36:16 +0200 Subject: [PATCH] BUG/MEDIUM: threads: fix incorrect thread group being used on soft-stop Commit 377e37a80 ("MINOR: tinfo: add the mask of enabled threads in each group") forgot -1 on the tgid, thus the groups was not always correctly tested, which is visible only when running with more than one group. No backport is needed. --- src/haproxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index e2503c228..145c19af9 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2985,7 +2985,7 @@ static void *run_thread_poll_loop(void *data) ptff->fct(); #ifdef USE_THREAD - if (!_HA_ATOMIC_AND_FETCH(&ha_tgroup_info[ti->tgid].threads_enabled, ~ti->ltid_bit)) + if (!_HA_ATOMIC_AND_FETCH(&ha_tgroup_info[ti->tgid-1].threads_enabled, ~ti->ltid_bit)) _HA_ATOMIC_AND(&all_tgroups_mask, ~tg->tgid_bit); _HA_ATOMIC_AND(&all_threads_mask, ~tid_bit); if (tid > 0) -- 2.47.3