Bug 1482224 Crash in Shutdown due to ProxyAutoConfig still aiming to resolve addressThis crash has arisen due to a loop in ProxyAutoConfig which spins until apending PAC request is complete, even when the ProxyAutoConfig object is beingshut... r=valentin
authorPolly Shaw <polly.shaw@gmail.com>
Wed, 22 Aug 2018 23:23:08 +0000
changeset 490684 cc2cb08f3759f4c0250c081c5696d13c5a86725a
parent 490683 265d09efe73f674a364194d4ad16dfd77d0aab57
child 490685 a28f7398ddff28f51ee1ac68203a02286bca6367
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1482224
milestone63.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 1482224 Crash in Shutdown due to ProxyAutoConfig still aiming to resolve addressThis crash has arisen due to a loop in ProxyAutoConfig which spins until apending PAC request is complete, even when the ProxyAutoConfig object is beingshut... r=valentin ...down. The remedy to prevent the crash is to exit the loop when the mShutdown flag is set. This does not attempt to address the underlying cause of why the request continues to be pending, although this is also a concern. Files changed: netwerk/base/ProxyAutoConfig.cpp - expanded lambda containing logic of when to stop waiting for the request to complete to include a check to the mShutdown flag. Also logged a warning if the loop is exited because of mShutdown. Differential Revision: https://phabricator.services.mozilla.com/D3977
netwerk/base/ProxyAutoConfig.cpp
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
@@ -447,17 +447,27 @@ ProxyAutoConfig::ResolveAddress(const ns
       mTimer->InitWithCallback(helper, aTimeout, nsITimer::TYPE_ONE_SHOT);
       helper->mTimer = mTimer;
     }
   }
 
   // Spin the event loop of the pac thread until lookup is complete.
   // nsPACman is responsible for keeping a queue and only allowing
   // one PAC execution at a time even when it is called re-entrantly.
-  SpinEventLoopUntil([&, helper]() { return !helper->mRequest; });
+  SpinEventLoopUntil([&, helper, this]() {
+    if (!helper->mRequest) {
+      return true;
+    }
+    if (this->mShutdown) {
+      NS_WARNING("mShutdown set with PAC request not cancelled");
+      MOZ_ASSERT(NS_FAILED(helper->mStatus));
+      return true;
+    }
+    return false;
+  });
 
   if (NS_FAILED(helper->mStatus) ||
       NS_FAILED(helper->mResponse->GetNextAddr(0, aNetAddr)))
     return false;
   return true;
 }
 
 static