From 4da91ffae47fb88ca8f80eaae5e23aa7ed9ec3a9 Mon Sep 17 00:00:00 2001 From: Otto Date: Tue, 21 Sep 2021 10:46:14 +0200 Subject: [PATCH] Tweaks --- pdns/pdns_recursor.cc | 1 + pdns/rec-lua-conf.cc | 2 ++ pdns/rec-lua-conf.hh | 1 + 3 files changed, 4 insertions(+) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 66dd782918..186e01de1a 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -5289,6 +5289,7 @@ static int serviceMain(int argc, char*argv[]) } startLuaConfigDelayedThreads(delayedLuaThreads, g_luaconfs.getCopy().generation); + delayedLuaThreads.rpzPrimaryThreads.clear(); // no longer needed makeThreadPipes(); diff --git a/pdns/rec-lua-conf.cc b/pdns/rec-lua-conf.cc index 65ebc3a129..bb315ed7b1 100644 --- a/pdns/rec-lua-conf.cc +++ b/pdns/rec-lua-conf.cc @@ -626,6 +626,8 @@ void startLuaConfigDelayedThreads(const luaConfigDelayedThreads& delayedThreads, { for (const auto& rpzPrimary : delayedThreads.rpzPrimaryThreads) { try { + // The get calls all return a value object here. That is esential, since we want copies so that RPZIXFRTracker gets values + // with the proper lifetime. std::thread t(RPZIXFRTracker, std::get<0>(rpzPrimary), std::get<1>(rpzPrimary), std::get<2>(rpzPrimary), std::get<3>(rpzPrimary), std::get<4>(rpzPrimary), std::get<5>(rpzPrimary), std::get<6>(rpzPrimary) * 1024 * 1024, std::get<7>(rpzPrimary), std::get<8>(rpzPrimary), std::get<9>(rpzPrimary), std::get<10>(rpzPrimary), std::get<11>(rpzPrimary), generation); t.detach(); } diff --git a/pdns/rec-lua-conf.hh b/pdns/rec-lua-conf.hh index 4b1fc27dd2..cc03bf99a2 100644 --- a/pdns/rec-lua-conf.hh +++ b/pdns/rec-lua-conf.hh @@ -85,6 +85,7 @@ extern GlobalStateHolder g_luaconfs; struct luaConfigDelayedThreads { + // Please make sure that the tuple below only contains value types since they are used as parameters in a thread ct std::vector, boost::optional, bool, uint32_t, size_t, TSIGTriplet, size_t, ComboAddress, uint16_t, uint32_t, std::shared_ptr, std::string> > rpzPrimaryThreads; }; -- 2.47.2