Backed out changeset 3325b46334d9 (bug 988464) for xpcshell test failure
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 17 Jul 2014 08:49:57 +0200
changeset 215355 c259eb48968020f6ae04ffed8832054c3f4ecba8
parent 215354 6094dd25da95dd73232dddf1472bcb717e80f7f6
child 215356 b623f53cdac13f68b8faea2d430192c952592fe3
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs988464
milestone33.0a1
backs out3325b46334d968ecf6fcb8a141aecc9424f43b9a
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
Backed out changeset 3325b46334d9 (bug 988464) for xpcshell test failure
build/automation.py.in
build/automationutils.py
xpcom/threads/nsThread.h
xpcom/threads/nsThreadManager.cpp
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -513,17 +513,17 @@ class Automation(object):
     # Crash on non-local network connections.
     env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '1'
 
     env['GNOME_DISABLE_CRASH_DIALOG'] = '1'
     env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
     env['NS_TRACE_MALLOC_DISABLE_STACKS'] = '1'
 
     # Set WebRTC logging in case it is not set yet
-    env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,nsThreadManager:5')
+    env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5')
     env.setdefault('R_LOG_LEVEL', '6')
     env.setdefault('R_LOG_DESTINATION', 'stderr')
     env.setdefault('R_LOG_VERBOSE', '1')
 
     # ASan specific environment stuff
     if self.IS_ASAN and (self.IS_LINUX or self.IS_MAC):
       # Symbolizer support
       llvmsym = os.path.join(xrePath, "llvm-symbolizer")
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -493,17 +493,17 @@ def environment(xrePath, env=None, crash
     env['MOZ_CRASHREPORTER'] = '1'
   else:
     env['MOZ_CRASHREPORTER_DISABLE'] = '1'
 
   # Crash on non-local network connections.
   env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '1'
 
   # Set WebRTC logging in case it is not set yet
-  env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,nsThreadManager:5')
+  env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5')
   env.setdefault('R_LOG_LEVEL', '6')
   env.setdefault('R_LOG_DESTINATION', 'stderr')
   env.setdefault('R_LOG_VERBOSE', '1')
 
   # ASan specific environment stuff
   asan = bool(mozinfo.info.get("asan"))
   if asan and (mozinfo.isLinux or mozinfo.isMac):
     try:
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -69,17 +69,16 @@ protected:
   static nsIThreadObserver* sMainThreadObserver;
 
   class nsChainedEventQueue;
 
   class nsNestedEventTarget;
   friend class nsNestedEventTarget;
 
   friend class nsThreadShutdownEvent;
-  friend class nsThreadManager;
 
   virtual ~nsThread();
 
   bool ShuttingDown()
   {
     return mShutdownContext != nullptr;
   }
 
@@ -152,22 +151,21 @@ protected:
     nsChainedEventQueue* mQueue;
 
   private:
     ~nsNestedEventTarget()
     {
     }
   };
 
-  // This lock protects access to mObserver, mEvents and mEventsAreDoomed
-  // and mShutdownRequired.  All of those fields (except mShutdownRequired)
-  // are only modified on the thread itself (never from another thread).
-  // This means that we can avoid holding the lock while using mObserver
-  // and mEvents on the thread itself.  When calling PutEvent on mEvents,
-  // we have to hold the lock to synchronize with PopEventQueue.
+  // This lock protects access to mObserver, mEvents and mEventsAreDoomed.
+  // All of those fields are only modified on the thread itself (never from
+  // another thread).  This means that we can avoid holding the lock while
+  // using mObserver and mEvents on the thread itself.  When calling PutEvent
+  // on mEvents, we have to hold the lock to synchronize with PopEventQueue.
   mozilla::Mutex mLock;
 
   nsCOMPtr<nsIThreadObserver> mObserver;
 
   // Only accessed on the target thread.
   nsAutoTObserverArray<nsCOMPtr<nsIThreadObserver>, 2> mEventObservers;
 
   nsChainedEventQueue* mEvents;  // never null
--- a/xpcom/threads/nsThreadManager.cpp
+++ b/xpcom/threads/nsThreadManager.cpp
@@ -13,31 +13,16 @@
 #include "mozilla/ThreadLocal.h"
 #ifdef MOZ_CANARY
 #include <fcntl.h>
 #include <unistd.h>
 #endif
 
 using namespace mozilla;
 
-#ifdef PR_LOGGING
-static PRLogModuleInfo *
-GetThreadManagerLog()
-{
-  static PRLogModuleInfo *sLog;
-  if (!sLog)
-    sLog = PR_NewLogModule("nsThreadManager");
-  return sLog;
-}
-#endif
-#ifdef LOG
-#undef LOG
-#endif
-#define LOG(args) PR_LOG(GetThreadManagerLog(), PR_LOG_DEBUG, args)
-
 #ifdef XP_WIN
 #include <windows.h>
 DWORD gTLSThreadIDIndex = TlsAlloc();
 #elif defined(NS_TLS)
 NS_TLS mozilla::threads::ID gTLSThreadID = mozilla::threads::Generic;
 #endif
 
 static mozilla::ThreadLocal<bool> sTLSIsMainThread;
@@ -173,55 +158,22 @@ nsThreadManager::Shutdown()
   // accepting new events, but that could lead to badness if one of those
   // threads is stuck waiting for a response from another thread.  To do it
   // right, we'd need some way to interrupt the threads.
   //
   // Instead, we process events on the current thread while waiting for threads
   // to shutdown.  This means that we have to preserve a mostly functioning
   // world until such time as the threads exit.
 
-  {
-#ifdef PR_LOGGING
-    // don't encourage other threads to run here by dumping log messages...
-    char buffer[4096];
-    char *ptr = buffer;
-    uint32_t leaked = 0;
-    for (uint32_t i = 0; i < threads.Length(); ++i) {
-      nsThread *thread = threads[i];
-      if (thread->ShutdownRequired()) {
-        leaked++;
-      }
-    }
-    if (leaked > 0) {
-      PR_snprintf(ptr, sizeof(buffer), "*** %u threads active at %s\n", leaked, __FUNCTION__);
-      ptr += strlen(ptr);
+  // Shutdown all threads that require it (join with threads that we created).
+  for (uint32_t i = 0; i < threads.Length(); ++i) {
+    nsThread* thread = threads[i];
+    if (thread->ShutdownRequired()) {
+      thread->Shutdown();
     }
-#endif
-
-    for (uint32_t i = 0; i < threads.Length(); ++i) {
-      nsThread *thread = threads[i];
-#ifdef PR_LOGGING
-      {
-        // So the PRThread can't go away while we're getting the name!
-        MutexAutoLock lock(thread->mLock);
-        if (thread->ShutdownRequired()) {
-          PRThread * prThread = thread->GetPRThread();
-          const char * name = PR_GetThreadName(prThread);
-          PR_snprintf(ptr, sizeof(buffer), "Thread %s (%p) still active\n", name ? name : "<unnamed>", thread);
-          ptr += strlen(ptr);
-        }
-      }
-#endif
-      if (thread->ShutdownRequired()) {
-        thread->Shutdown();
-      }
-    }
-#ifdef PR_LOGGING
-    LOG(("%s", buffer));
-#endif
   }
 
   // In case there are any more events somehow...
   NS_ProcessPendingEvents(mMainThread);
 
   // There are no more background threads at this point.
 
   // Clear the table of threads.