Bug 1451262 - Call NS_ProcessPendingEvents after StopSSLServerCertVerificationThreads. r=mayhemer, a=RyanVM
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 10 May 2018 10:37:24 +0200
changeset 473294 720baaffac8cf0b71e351720bc3617a508d039d1
parent 473293 453294133297be02ae10459bf4e430ba1df039a0
child 473295 1da8d36ce5a4c6f41863ecd4edd5b0ae5c548c69
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, RyanVM
bugs1451262
milestone61.0
Bug 1451262 - Call NS_ProcessPendingEvents after StopSSLServerCertVerificationThreads. r=mayhemer, a=RyanVM If there are still pending events after we null out gSocketThread, OnSocketThread() will always return false, which can trigger assertions. MozReview-Commit-ID: CovFIU3cKL
netwerk/base/nsSocketTransportService2.cpp
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -1062,17 +1062,22 @@ nsSocketTransportService::Run()
 
     // detach all sockets, including locals
     Reset(false);
 
     // Final pass over the event queue. This makes sure that events posted by
     // socket detach handlers get processed.
     NS_ProcessPendingEvents(mRawThread);
 
+    // Stopping the SLL threads can generate new events, so we need to
+    // process them before nulling out gSocketThread, otherwise we can get
+    // !onSocketThread assertions.
     psm::StopSSLServerCertVerificationThreads();
+    NS_ProcessPendingEvents(mRawThread);
+
     gSocketThread = nullptr;
 
     SOCKET_LOG(("STS thread exit\n"));
 
     return NS_OK;
 }
 
 void