]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid mthread race when using the set of rootNSZones. 8528/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, 13 Nov 2019 14:07:06 +0000 (15:07 +0100)
pdns/reczones.cc

index 505a18402edda79e9591881954ce3b882c019e95..98a34b9beab2a8ddd215ed087d56ad4cd42bc6e4 100644 (file)
@@ -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<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);