MINOR: debug: add a function to dump a stuck thread
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Nov 2024 10:20:45 +0000 (11:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Nov 2024 18:04:38 +0000 (19:04 +0100)
commit80ea59459c84ff0591d100a621243558a6d6a682
tree0fcdffe5400a1eca326edf5f86e8f309fb2e0d81
parente50dc3bd87d058736668400607558755ac06fe0f
MINOR: debug: add a function to dump a stuck thread

There's currently no way to just emit a warning informing that a thread
is stuck without crashing. This is a problem because sometimes users
would benefit from this info to clean up their configuration (e.g. abuse
of map_regm, lua-load etc).

This commit adds a new function ha_stuck_warning() that will emit a
warning indicating that the designated thread has been stuck for XX
milliseconds, with a number of streams blocked, and will make that
thread dump its own state. The warning will then be sent to stderr,
along with some reminders about the impacts of such situations to
encourage users to fix their configuration.

In order not to disrupt operations, a local 4kB buffer is allocated
in the stack. This should be quite sufficient.

For now the function is not used.

(cherry picked from commit 0950778b3a13fe31ff83223827d6692076cba5e5)
Signed-off-by: Willy Tarreau <w@1wt.eu>
include/haproxy/debug.h
src/debug.c