Bug 1520642 - Cancel dns requests before cleaning up db. r=kershaw
authorDragana Damjanovic <dd.mozilla@gmail.com>
Fri, 08 Feb 2019 09:34:34 +0000
changeset 516122 8ec307e6000f2dd392c4ca269c73aa75a9758702
parent 516121 b482c6618d72ac38a9a82fbccf425e0a7f8b6129
child 516123 013ef288b97c79e0999747dc45091f779c3d2bd2
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskershaw
bugs1520642
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520642 - Cancel dns requests before cleaning up db. r=kershaw Differential Revision: https://phabricator.services.mozilla.com/D18989
netwerk/dns/nsHostResolver.cpp
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -773,16 +773,19 @@ void nsHostResolver::Shutdown() {
     pendingQLow = std::move(mLowQ);
     evictionQ = std::move(mEvictionQ);
 
     mEvictionQSize = 0;
     mPendingCount = 0;
 
     if (mNumIdleTasks) mIdleTaskCV.NotifyAll();
 
+    for (auto iter = mRecordDB.Iter(); !iter.Done(); iter.Next()) {
+      iter.UserData()->Cancel();
+    }
     // empty host database
     mRecordDB.Clear();
   }
 
   ClearPendingQueue(pendingQHigh);
   ClearPendingQueue(pendingQMed);
   ClearPendingQueue(pendingQLow);
 
@@ -792,20 +795,16 @@ void nsHostResolver::Shutdown() {
     }
   }
 
   pendingQHigh.clear();
   pendingQMed.clear();
   pendingQLow.clear();
   evictionQ.clear();
 
-  for (auto iter = mRecordDB.Iter(); !iter.Done(); iter.Next()) {
-    iter.UserData()->Cancel();
-  }
-
   // Shutdown the resolver threads, but with a timeout of 20 seconds.
   // If the timeout is exceeded, any stuck threads will be leaked.
   mResolverThreads->ShutdownWithTimeout(20 * 1000);
 
   {
     mozilla::DebugOnly<nsresult> rv = GetAddrInfoShutdown();
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to shutdown GetAddrInfo");
   }