From 61253c3a0302beffb3bc1040f77eb284acfc3082 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Sat, 13 Sep 2025 22:37:42 +0200 Subject: [PATCH] auth LUA shared exec: reset exec limit for every invocation fixes #16118 --- pdns/lua-record.cc | 8 ++++---- regression-tests.auth-py/test_LuaRecords.py | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index d649beaba1..cc8c235ec2 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 6ea2ef1622..b79b7c6a9d 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): -- 2.47.3