DEBUG: lua: add tainted flags for stuck Lua contexts
authorWilly Tarreau <w@1wt.eu>
Wed, 25 Oct 2023 13:02:59 +0000 (15:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 25 Oct 2023 13:48:02 +0000 (15:48 +0200)
commit26a6481f007c0f8a264c6d9bca891a67780edb9b
treec5fbce0fca6ff17a46f4132ccf8775d954c5a08b
parent46bbb3a33be4be1cf8a54b39dbd57433501229e8
DEBUG: lua: add tainted flags for stuck Lua contexts

William suggested that since we can detect the presence of Lua in the
stack, let's combine it with stuck detection to set a new pair of flags
indicating a stuck Lua context and a stuck Lua shared context.

Now, executing an infinite loop in a Lua sample fetch function with
yield disabled crashes with tainted=0xe40 if loaded from a lua-load
statement, or tainted=0x640 from a lua-load-per-thread statement.

In addition, at the end of the panic dump, we can check if Lua was
seen stuck and emit recommendations about lua-load-per-thread and
the choice of dependencies depending on the presence of threads
and/or shared context.
include/haproxy/bug.h
src/debug.c