From f41bee4766077b89957032ea329d642342017a54 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 6 Nov 2019 11:15:30 +0100 Subject: [PATCH] Avoid mthread race when using the set of rootNSZones. --- pdns/reczones.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 505a18402e..98a34b9bea 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -126,7 +126,11 @@ void primeRootNSZones(bool dnssecmode) sr.setDoDNSSEC(true); sr.setDNSSECValidationRequested(true); } - for (const auto & qname: t_rootNSZones) { + + // beginResolve() can yield to another mthread that could trigger t_rootNSZones updates, + // so make a local copy + set copy(t_rootNSZones); + for (const auto & qname: copy) { t_RC->doWipeCache(qname, false, QType::NS); vector ret; sr.beginResolve(qname, QType(QType::NS), QClass::IN, ret); -- 2.47.2