From f2dd76c40c917b09a8530347733537adced22c10 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 17 Mar 2023 11:35:55 +0100 Subject: [PATCH] Prevent data race by initing NOD protobuf tag values not in the NOD threads but in the main thread --- pdns/recursordist/rec-main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 7a5beab8be..82365a9135 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -746,7 +746,6 @@ static void setupNODThread(Logr::log_t log) } std::thread t(nod::NODDB::startHousekeepingThread, t_nodDBp, std::this_thread::get_id()); t.detach(); - g_nod_pbtag = ::arg()["new-domain-pb-tag"]; } if (g_udrEnabled) { uint32_t num_cells = ::arg().asNum("unique-response-db-size"); @@ -766,7 +765,6 @@ static void setupNODThread(Logr::log_t log) } std::thread t(nod::UniqueResponseDB::startHousekeepingThread, t_udrDBp, std::this_thread::get_id()); t.detach(); - g_udr_pbtag = ::arg()["unique-response-pb-tag"]; } } @@ -791,6 +789,8 @@ static void setupNODGlobal() // Setup Unique DNS Response subsystem g_udrEnabled = ::arg().mustDo("unique-response-tracking"); g_udrLog = ::arg().mustDo("unique-response-log"); + g_nod_pbtag = ::arg()["new-domain-pb-tag"]; + g_udr_pbtag = ::arg()["unique-response-pb-tag"]; } #endif /* NOD_ENABLED */ -- 2.47.2