From e7bd9ea3628249f92a30679287d65d7ecdf18785 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Wed, 7 Oct 2026 12:43:35 +0200 Subject: [PATCH] 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. --- src/hlua.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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) -- 2.47.3