Bug 1273475 - Use release assertions for PSM->NSS shutdown. r=ttaubert, a=lizzard
authorJ.C. Jones <jjones@mozilla.com>
Fri, 05 Aug 2016 14:47:23 -0700
changeset 350010 d52d39c46763f03f5e663f5a40f22478380fdedc
parent 350009 97cd2fba07b3deb43dc1d14a1babb0446c917f63
child 350011 524e793f63aa37fc7f8f911cfc3de8018fb4f311
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert, lizzard
bugs1273475
milestone50.0a2
Bug 1273475 - Use release assertions for PSM->NSS shutdown. r=ttaubert, a=lizzard Update the prior patch to use MOZ_RELEASE_ASSERT so that we cleanly crash if there's still an error somewhere in this logic, instead of deadlocking on beta (but crashing on aurora). MozReview-Commit-ID: InttEcC55Dn
security/manager/ssl/nsNSSComponent.cpp
security/manager/ssl/nsNSSShutDown.cpp
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -251,26 +251,26 @@ GetRevocationBehaviorFromPrefs(/*out*/ C
 nsNSSComponent::nsNSSComponent()
   : mutex("nsNSSComponent.mutex")
   , mNSSInitialized(false)
 #ifndef MOZ_NO_SMART_CARDS
   , mThreadList(nullptr)
 #endif
 {
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::ctor\n"));
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
   NS_ASSERTION( (0 == mInstanceCount), "nsNSSComponent is a singleton, but instantiated multiple times!");
   ++mInstanceCount;
 }
 
 nsNSSComponent::~nsNSSComponent()
 {
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::dtor\n"));
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
   // All cleanup code requiring services needs to happen in xpcom_shutdown
 
   ShutdownNSS();
   SharedSSLState::GlobalCleanup();
   RememberCertErrorsTable::Cleanup();
   --mInstanceCount;
   nsNSSShutDownList::shutdown();
@@ -1832,17 +1832,17 @@ nsNSSComponent::InitializeNSS()
 
 void
 nsNSSComponent::ShutdownNSS()
 {
   // Can be called both during init and profile change,
   // needs mutex protection.
 
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::ShutdownNSS\n"));
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
   MutexAutoLock lock(mutex);
 
   if (mNSSInitialized) {
     mNSSInitialized = false;
 
     PK11_SetPasswordFunc((PK11PasswordFunc)nullptr);
 
@@ -1876,17 +1876,17 @@ nsNSSComponent::ShutdownNSS()
       MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS shutdown =====>> OK <<====="));
     }
   }
 }
 
 nsresult
 nsNSSComponent::Init()
 {
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (!NS_IsMainThread()) {
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
   nsresult rv = NS_OK;
 
   MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n"));
 
--- a/security/manager/ssl/nsNSSShutDown.cpp
+++ b/security/manager/ssl/nsNSSShutDown.cpp
@@ -122,17 +122,17 @@ nsresult nsNSSShutDownList::doPK11Logout
     }
   }
 
   return NS_OK;
 }
 
 nsresult nsNSSShutDownList::evaporateAllNSSResources()
 {
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (!NS_IsMainThread()) {
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
   StaticMutexAutoLock lock(sListLock);
   // Other threads can acquire an nsNSSShutDownPreventionLock and cause this
   // thread to block when it calls restructActivityToCurrentThread, below. If
   // those other threads then attempt to create an object that must be
@@ -207,17 +207,17 @@ bool nsNSSShutDownList::construct(const 
     singleton = new nsNSSShutDownList();
   }
 
   return !!singleton;
 }
 
 void nsNSSShutDownList::shutdown()
 {
-  MOZ_ASSERT(NS_IsMainThread());
+  MOZ_RELEASE_ASSERT(NS_IsMainThread());
   StaticMutexAutoLock lock(sListLock);
   sInShutdown = true;
 
   if (singleton) {
     delete singleton;
   }
 }