]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: debug: fix parallel thread dumps again
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 11:14:03 +0000 (13:14 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 17:41:26 +0000 (19:41 +0200)
commitf0c86ddfe8067ffd53bc818c370510f7cfc1780e
tree936421c2522a37975eb343af3033a20a3caf1066
parent55433f9b344b430f3f8ec91106b9d8772168eafc
BUG/MEDIUM: debug: fix parallel thread dumps again

The previous attempt to fix thread dumps in commit 672972604 ("BUG/MEDIUM:
debug: fix possible hang when multiple threads dump at once") still had
some shortcomings. Sometimes parallel dumps are jerky essentially due to
the way that threads synchronize on startup and end. In addition the risk
of waiting forever for a stopped thread exists, and panics happening in
parallel to thread dumps are not more reliable either.

This commit revisits the state transitions so that all threads may request
a dump in parallel, that all of them wait for each other in the handler,
and that one thread is responsible for counting every other and checking
that the total matches the number of active threads.

Then for stopping there's a finishing phase that all threads wait for so
that none quits this area too early. Given that we now know the number of
participants to the dump, we can let them each decrement the counter when
leaving so that another dump may only start after the last participant
has completely left.

Now many thread dumps in parallel are running fine, so do panics. No
backport is needed as this was the result of the changes for thread
groups.
src/debug.c