From 2a0276a91d511bc766d485eddcc081f699a82e8a Mon Sep 17 00:00:00 2001 From: Charles-Henri Bruyand Date: Wed, 6 Jun 2018 09:22:12 +0200 Subject: [PATCH] rec: REALLY restrict maintenance() callback to worker threads --- pdns/pdns_recursor.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 8f059369f6..def4cd11b8 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -3556,11 +3556,14 @@ try last_carbon = g_now.tv_sec; } } - if (worker && t_pdl != nullptr) { + if (t_pdl != nullptr) { // lua-dns-script directive is present, call the maintenance callback if needed - if(g_now.tv_sec - last_lua_maintenance >= luaMaintenanceInterval) { - t_pdl->maintenance(); - last_lua_maintenance = g_now.tv_sec; + if (worker && (!g_weDistributeQueries || t_id != s_distributorThreadID)) { + // Only on threads processing queries + if(g_now.tv_sec - last_lua_maintenance >= luaMaintenanceInterval) { + t_pdl->maintenance(); + last_lua_maintenance = g_now.tv_sec; + } } } -- 2.47.2