Bug 1498782 - Skip thread shutdown in nsHostResolver if there are still active threads after a delay r=bagder
☠☠ backed out by 86474265d163 ☠ ☠
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 17 Oct 2018 06:24:39 +0000
changeset 490014 a4b43a47589a481f19fd60184881ed5d8caddd73
parent 490013 8d8ed5f447d03c13e0503c6fa4d113116817fd21
child 490015 bff7126ddd3fbe19e3468b4c6896b45cf636582e
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersbagder
bugs1498782
milestone64.0a1
Bug 1498782 - Skip thread shutdown in nsHostResolver if there are still active threads after a delay r=bagder Differential Revision: https://phabricator.services.mozilla.com/D8725
netwerk/dns/nsHostResolver.cpp
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -865,17 +865,22 @@ nsHostResolver::Shutdown()
 #endif
 
     {
         mozilla::DebugOnly<nsresult> rv = GetAddrInfoShutdown();
         NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
                              "Failed to shutdown GetAddrInfo");
     }
 
-    mResolverThreads->Shutdown();
+    // It is possible that there are still threads waiting on a very slow DNS
+    // query. In that case, it's better just to skip the thread shutdown,
+    // or we might trigger the shutdownhang reporter.
+    if (mActiveTaskCount == 0) {
+        mResolverThreads->Shutdown();
+    }
 }
 
 nsresult
 nsHostResolver::GetHostRecord(const nsACString &host, uint16_t type,
                               uint16_t flags, uint16_t af, bool pb,
                               const nsCString &originSuffix,
                               nsHostRecord **result)
 {