]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: debug: mark oneself harmless while waiting for threads to finish
authorWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 15:19:14 +0000 (17:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Jul 2022 17:26:35 +0000 (19:26 +0200)
commitf7afdd910b09fd334585e62fc118d097be716350
tree6cd62070185d46494b60f902a4635c2b6f8f5d00
parenta2b8ed4b440786eefaf6f783a5a003c3f079126a
MINOR: debug: mark oneself harmless while waiting for threads to finish

The debug_handler() function waits for other threads to join, but does
not mark itself as harmless, so if at the same time another thread tries
to isolate, this may deadlock. In practice this does not happen as the
signal is received during epoll_wait() hence under harmless mode, but
it can possibly arrive under other conditions.

In order to improve this, while waiting for other threads to join, we're
now marking the current thread as harmless, as it's doing nothing but
waiting for the other ones. This way another harmless waiter will be able
to proceed. It's valid to do this since we're not doing anything else in
this loop.

One improvement could be to also check for the thread being idle and
marking it idle in addition to harmless, so that it can even release a
full isolation requester. But that really doesn't look worth it.
src/debug.c