]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: debug: Don't dump the lua stack if it is not initialized
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2020 17:08:05 +0000 (19:08 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Jul 2020 07:37:18 +0000 (09:37 +0200)
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.

src/debug.c

index e173f4277cd9eb5b5c3c38c50b5446f696723884..b2a4c6bacb643f6f3d3ffcb8c3a1af960aa2262a 100644 (file)
@@ -222,11 +222,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
 }