From: Peter van Dijk Date: Sat, 13 Sep 2025 20:37:42 +0000 (+0200) Subject: auth LUA shared exec: reset exec limit for every invocation X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F16119%2Fhead;p=thirdparty%2Fpdns.git auth LUA shared exec: reset exec limit for every invocation fixes #16118 --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index d649beaba..cc8c235ec 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -1635,10 +1635,6 @@ static void setupLuaRecords(LuaContext& lua) lua_report(event, line); }); - if (g_luaRecordExecLimit > 0) { - lua.executeCode(boost::str(boost::format("debug.sethook(report, '', %d)") % g_luaRecordExecLimit)); - } - lua.writeFunction("latlon", []() -> string { return lua_latlon(); }); @@ -1800,6 +1796,10 @@ std::vector> luaSynth(const std::string& code, cons } lua.writeVariable("bestwho", s_lua_record_ctx->bestwho); + if (g_luaRecordExecLimit > 0) { + lua.executeCode(boost::str(boost::format("debug.sethook(report, '', %d)") % g_luaRecordExecLimit)); + } + try { string actual; if(!code.empty() && code[0]!=';') diff --git a/regression-tests.auth-py/test_LuaRecords.py b/regression-tests.auth-py/test_LuaRecords.py index 6ea2ef162..b79b7c6a9 100644 --- a/regression-tests.auth-py/test_LuaRecords.py +++ b/regression-tests.auth-py/test_LuaRecords.py @@ -1250,7 +1250,6 @@ any-to-tcp=no enable-lua-records=shared lua-records-insert-whitespace=yes lua-health-checks-interval=1 -lua-records-exec-limit=1500 """ def testCounter(self):