From: Aurelien DARRAGON Date: Wed, 7 Oct 2026 10:43:35 +0000 (+0200) Subject: BUG/MINOR: hlua: assume proxy_find_by_id() may return NULL on previously existing... X-Git-Tag: v3.5-dev9~42 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=e7bd9ea3628249f92a30679287d65d7ecdf18785;p=haproxy.git BUG/MINOR: hlua: assume proxy_find_by_id() may return NULL on previously existing server Since 3.4 and dynamic backends, we may hit a race were a backend which existed at the time the event was published does not exist anymore when the event is processed. Previously it was assumed the proxy referenced by a server event would always exist (since proxies couldn't be removed dynamically), and a BUG_ON() ensured that. But it is not true anymore, thus we need to check for proxy_find_by_id() NULL return value, which indicates that the proxy was removed since, and thus it is not worth looking for the server which triggered the event anyway. It should be backported to 3.4. --- diff --git a/src/hlua.c b/src/hlua.c index 255dccf05..46d7cc96e 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -9567,12 +9567,13 @@ __LJMP static void hlua_event_hdl_cb_push_args(struct hlua_event_sub *hlua_sub, * (if it wasn't removed yet, SERVER_DEL will never succeed here) */ px = proxy_find_by_id(e_server->safe.proxy_uuid, PR_CAP_BE, 0); - BUG_ON(!px); - server = server_find_by_id_unique(px, e_server->safe.puid, e_server->safe.rid); - if (server) { - lua_pushstring(hlua->T, "reference"); - hlua_fcn_new_server(hlua->T, server); - lua_settable(hlua->T, -3); + if (px) { + server = server_find_by_id_unique(px, e_server->safe.puid, e_server->safe.rid); + if (server) { + lua_pushstring(hlua->T, "reference"); + hlua_fcn_new_server(hlua->T, server); + lua_settable(hlua->T, -3); + } } } #if defined(HAVE_ACME)