]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: debug: make the thread dump code show Lua backtraces
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Aug 2019 12:16:02 +0000 (14:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Aug 2019 12:32:09 +0000 (14:32 +0200)
commit78a7cb648ca33823c06430cedc6859ea7e7cd5df
treeee4b09725c11002718a807902921ca60d77a1729
parent60409db0b1743d670e54244425f6e08c389b7dde
MEDIUM: debug: make the thread dump code show Lua backtraces

When we dump a thread's state (show thread, panic) we don't know if
anything is happening in Lua, which can be problematic especially when
calling external functions. With this patch, the thread dump code can
now detect if we're running in a global Lua task (hlua_process_task),
or in a TCP or HTTP Lua service (task_run_applet and applet.fct ==
hlua_applet_tcp_fct or http_applet_http_fct), or a fetch/converter
from an analyser (s->hlua != NULL). In such situations, it's able to
append a formatted Lua backtrace of the Lua execution path with
function names, file names and line numbers.

Note that a shorter alternative could be to call "luaL_where(hlua->T,0)"
which only prints the current location, but it's not necessarily sufficient
for complex code.
src/debug.c