]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: debug: add support for dumping backtraces of stuck threads
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 14:40:23 +0000 (15:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 3 Mar 2020 17:40:03 +0000 (18:40 +0100)
commitf5b4e064dcb1f7c97c87b68dbbbf7a4371e05bc7
treefcbf65832cb33d7d55fb447ca4bdfa45d7e6aea4
parentcf12f2ee6665281342487a0a3517ba3286245550
MEDIUM: debug: add support for dumping backtraces of stuck threads

When a panic() occurs due to a stuck thread, we'll try to dump a
backtrace of this thread if the config directive USE_BACKTRACE is
set (which is the case on linux+glibc). For this we use the
backtrace() call provided by glibc and iterate the pointers through
resolve_sym_name(). In order to minimize the output (which is limited
to one buffer), we only do this for stuck threads, and we start the
dump above ha_panic()/ha_thread_dump_all_to_trash(), and stop when
meeting known points such as main/run_tasks_from_list/run_poll_loop.

If enabled without USE_DL, the dump will be complete with no details
except that pointers will all be given relative to main, which is
still better than nothing.

The new USE_BACKTRACE config option is enabled by default on glibc since
it has been present for ages. When it is set, the export-dynamic linker
option is enabled so that all non-static symbols are properly resolved.
Makefile
src/debug.c