]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid mthread race when using the set of rootNSZones. 8510/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Nov 2019 10:15:30 +0000 (11:15 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Nov 2019 10:15:30 +0000 (11:15 +0100)
pdns/reczones.cc

index c811b0c98946a0dea863b29649aecd36593fc38e..cade82750ace6102a2bc8aaef17448395eccb17e 100644 (file)
@@ -127,7 +127,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<DNSName> copy(t_rootNSZones);  
+  for (const auto & qname: copy) {
     t_RC->doWipeCache(qname, false, QType::NS);
     vector<DNSRecord> ret;
     sr.beginResolve(qname, QType(QType::NS), QClass::IN, ret);