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 470762 720baaffac8cf0b71e351720bc3617a508d039d1
parent 470761 453294133297be02ae10459bf4e430ba1df039a0
child 470763 1da8d36ce5a4c6f41863ecd4edd5b0ae5c548c69
push id9218
push userryanvm@gmail.com
push dateSun, 13 May 2018 19:56:21 +0000
treeherdermozilla-beta@5fcefe47c777 [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