]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua: undetected infinite loop
authorThierry FOURNIER <tfournier@haproxy.com>
Fri, 13 Mar 2015 13:50:06 +0000 (14:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 14 Mar 2015 14:54:35 +0000 (15:54 +0100)
If the Lua code causes an infinite loop without yield possible, the
clock is not updated. This patch check the clock when the Lua control
code cannot yield.

src/hlua.c

index c76eb1ea72c68f84aa56671be74f05ffdf02ce82..7e416f20c1dd90fc947d0962e9fbff9401c52ad7 100644 (file)
@@ -856,7 +856,8 @@ void hlua_hook(lua_State *L, lua_Debug *ar)
        if (lua_isyieldable(L))
                WILL_LJMP(hlua_yieldk(L, 0, 0, NULL, TICK_ETERNITY, HLUA_CTRLYIELD));
 
-       /* If we cannot yield, check the timeout. */
+       /* If we cannot yield, update the clock and check the timeout. */
+       tv_update_date(0, 1);
        if (tick_is_expired(hlua->expire, now_ms)) {
                lua_pushfstring(L, "execution timeout");
                WILL_LJMP(lua_error(L));