]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: debug/threads: implement an advanced thread dump system
authorWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 08:08:49 +0000 (10:08 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 May 2019 15:16:20 +0000 (17:16 +0200)
commitc7091d89aed849af01fbaa310f06bfa66ee30132
treedf378c58a58240a55abe426dadac599843ea6e61
parent0ad46fa6f5bc0ccb2514150661b389c14abbf1d8
MEDIUM: debug/threads: implement an advanced thread dump system

The current "show threads" command was too limited as it was not possible
to dump other threads' detailed states (e.g. their tasks). This patch
goes further by using thread signals so that each thread can dump its
own state in turn into a shared buffer provided by the caller. Threads
are synchronized using a mechanism very similar to the rendez-vous point
and using this method, each thread can safely dump any of its contents
and the caller can finally report the aggregated ones from the buffer.

It is important to keep in mind that the list of signal-safe functions
is limited, so we take care of only using chunk_printf() to write to a
pre-allocated buffer.

This mechanism is enabled by USE_THREAD_DUMP and is enabled by default
on Linux 2.6.28+. On other platforms it falls back to the previous
solution using the loop and the less precise dump.
Makefile
doc/management.txt
include/common/debug.h
src/debug.c