From: Aurelien DARRAGON Date: Tue, 11 Jul 2023 13:42:00 +0000 (+0200) Subject: BUG/MINOR: hlua_fcn/queue: use atomic load to fetch queue size X-Git-Tag: v2.9-dev2~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33a8c2842bcb11395a1e174f852f02e810c0ce67;p=thirdparty%2Fhaproxy.git BUG/MINOR: hlua_fcn/queue: use atomic load to fetch queue size In hlua_queue_size(), queue size is loaded as a regular int, but the queue might be shared by multiple threads that could perform some atomic pushing or popping attempts in parallel, so we better use an atomic load operation to guarantee consistent readings. This could be backported in 2.8. --- diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index 91c5155d22..63366694fd 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -542,7 +542,7 @@ static int hlua_queue_size(lua_State *L) struct hlua_queue *queue = hlua_check_queue(L, 1); BUG_ON(!queue); - lua_pushinteger(L, queue->size); + lua_pushinteger(L, HA_ATOMIC_LOAD(&queue->size)); return 1; }