From 1641153b210f9cc6a7d0f0650a4a5313d0fb8919 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 24 Jul 2020 19:08:05 +0200 Subject: [PATCH] BUG/MINOR: debug: Don't dump the lua stack if it is not initialized When the watchdog is fired because of the lua, the stack of the corresponding lua context is dumped. But we must be sure the lua context is fully initialized to do so. If we are blocked on the global lua lock, during the lua context initialization, the lua stask may be NULL. This patch should fix the issue #776. It must be backported as far as 2.0. (cherry picked from commit 471425f51d71d1214abeee40439a51a2a3217102) Signed-off-by: Christopher Faulet (cherry picked from commit f9f875213809d0d08857def5ce4f76d6b747fbd6) Signed-off-by: Christopher Faulet --- src/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debug.c b/src/debug.c index e1cd500..75ca45a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -218,11 +218,13 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx) chunk_appendf(buf, "%sCurrent executing a Lua HTTP service -- ", pfx); } - if (hlua) { + if (hlua && hlua->T) { luaL_traceback(hlua->T, hlua->T, NULL, 0); if (!append_prefixed_str(buf, lua_tostring(hlua->T, -1), pfx, '\n', 1)) b_putchr(buf, '\n'); } + else + b_putchr(buf, '\n'); #endif } -- 1.7.10.4