From: Christopher Faulet Date: Tue, 1 Sep 2026 14:51:54 +0000 (+0200) Subject: BUN/MINOR: hlua: reset hlua_body variable after per-thread files loading X-Git-Tag: v3.5-dev6~27 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=10581b95e8a07dd95a98e3cd9d116213a4d63f52;p=haproxy.git BUN/MINOR: hlua: reset hlua_body variable after per-thread files loading hlua_body variable was introduced to know if the files loading was passed or not and emit warnings if some operations are performed during runtime. In particular, it was used to detect calls to core.use_native_mailers_config() during runtime. However, the hlua_body variable was reset too early in the post-init function, before the per-thread files loading. Because of this issue, loading mailers.lua script using 'lua-load-per-thread' directive led to the following error during haproxy startup: ... use_native_mailers_config: not available outside of body context To fix the issue, this variable is now reset at the end of the function. This patch must be backported as far as 3.3. It should fix the issue #3487. --- diff --git a/src/hlua.c b/src/hlua.c index 1882db98a..a4d682635 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -13520,9 +13520,6 @@ int hlua_post_init() struct hlua_function *fcn; struct hlua_reg_filter *reg_flt; - hlua_body = 0; - - #if defined(USE_OPENSSL) /* Initialize SSL server. */ if (socket_ssl->xprt->prepare_srv) { @@ -13642,6 +13639,8 @@ int hlua_post_init() if (errors > 0) return 0; + hlua_body = 0; + /* after this point, this global will no longer be used, so set to * -1 in order to have probably a segfault if someone use it */