From 21c33253b3cfa4d702e2e01b19ae523e9ce9e93c Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 26 Feb 2024 09:09:54 +0100 Subject: [PATCH] Do not keep a ref to a lua config around in startup code --- pdns/recursordist/rec-main.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 54d117bd73..e652ddb0cc 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -2752,8 +2752,7 @@ static void recursorThread() } } - unsigned int ringsize = ::arg().asNum("stats-ringbuffer-entries") / RecThreadInfo::numUDPWorkers(); - if (ringsize != 0) { + if (unsigned int ringsize = ::arg().asNum("stats-ringbuffer-entries") / RecThreadInfo::numUDPWorkers(); ringsize != 0) { t_remotes = std::make_unique(); if (RecThreadInfo::weDistributeQueries()) { t_remotes->set_capacity(::arg().asNum("stats-ringbuffer-entries") / RecThreadInfo::numDistributors()); @@ -2780,14 +2779,16 @@ static void recursorThread() g_multiTasker = std::make_unique(::arg().asNum("stack-size"), ::arg().asNum("stack-cache-size")); threadInfo.setMT(g_multiTasker.get()); - /* start protobuf export threads if needed */ - auto luaconfsLocal = g_luaconfs.getLocal(); - checkProtobufExport(luaconfsLocal); - checkOutgoingProtobufExport(luaconfsLocal); + { + /* start protobuf export threads if needed, don;'t keep a ref to lua config around */ + auto luaconfsLocal = g_luaconfs.getLocal(); + checkProtobufExport(luaconfsLocal); + checkOutgoingProtobufExport(luaconfsLocal); #ifdef HAVE_FSTRM - checkFrameStreamExport(luaconfsLocal, luaconfsLocal->frameStreamExportConfig, t_frameStreamServersInfo); - checkFrameStreamExport(luaconfsLocal, luaconfsLocal->nodFrameStreamExportConfig, t_nodFrameStreamServersInfo); + checkFrameStreamExport(luaconfsLocal, luaconfsLocal->frameStreamExportConfig, t_frameStreamServersInfo); + checkFrameStreamExport(luaconfsLocal, luaconfsLocal->nodFrameStreamExportConfig, t_nodFrameStreamServersInfo); #endif + } t_fdm = unique_ptr(getMultiplexer(log)); -- 2.47.2