]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: thread: mask stopping_threads with threads_enabled when checking it
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 08:13:05 +0000 (10:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 08:19:46 +0000 (10:19 +0200)
commitf34a3fa33d519ffe57f5e9834d4b0b08ef438b3d
treec0ea7cbedbb6b68f4125cf6afe8596595b6df423
parent4c3d3d2a685bb4f33c7dae44a6f56fcce1689dcf
BUG/MEDIUM: thread: mask stopping_threads with threads_enabled when checking it

When soft-stopping, there's a comparison between stopping_threads and
threads_enabled to make sure all threads are stopped, but this is not
correct and is racy since the threads_enabled bit is removed when a
thread is stopped but not its stopping_threads bit. The consequence is
that depending on timing, when stopping, if the first stopping thread
is fast enough to remove its bit from threads_enabled, the other threads
will see that stopping_threads doesn't match threads_enabled anymore and
will wait forever. As such the mask must be applied to stopping_threads
during the test. This issue was introduced in recent commit ef422ced9
("MEDIUM: thread: make stopping_threads per-group and add stopping_tgroups"),
no backport is needed.
src/haproxy.c