Bug 1120485. Log CloseHandle error reason during MessageChannel shutdown failure. r=milan
authorMason Chang <mchang@mozilla.com>
Wed, 06 Apr 2016 09:03:22 -0700
changeset 291893 9ae0a0f6a9ee54ab8c19790d55c71e71413ac0ad
parent 291892 21b79c0204a8c90cffc082cd6cdb09363051245c
child 291894 65e9d46daf3ebdc89f12ecfb4bcc88c0257307d3
push id74718
push usermchang@mozilla.com
push dateWed, 06 Apr 2016 16:03:37 +0000
treeherdermozilla-inbound@9ae0a0f6a9ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1120485
milestone48.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 1120485. Log CloseHandle error reason during MessageChannel shutdown failure. r=milan
gfx/2d/Logging.h
ipc/glue/MessageChannel.cpp
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -129,16 +129,17 @@ enum class LogReason : int {
   GlyphAllocFailedCairo,
   GlyphAllocFailedCG,
   InvalidRect,
   CannotDraw3D, // 20
   IncompatibleBasicTexturedEffect,
   InvalidFont,
   PAllocTextureBackendMismatch,
   GetFontFileDataFailed,
+  MessageChannelCloseFailure,
   // End
   MustBeLessThanThis = 101,
 };
 
 struct BasicLogger
 {
   // For efficiency, this method exists and copies the logic of the
   // OutputMessage below.  If making any changes here, also make it
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -9,21 +9,22 @@
 #include "mozilla/ipc/ProtocolUtils.h"
 
 #include "mozilla/dom/ScriptSettings.h"
 
 #include "mozilla/Assertions.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/Move.h"
 #include "mozilla/SizePrintfMacros.h"
+#include "mozilla/Snprintf.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/Logging.h"
 #include "nsDebug.h"
 #include "nsISupportsImpl.h"
 #include "nsContentUtils.h"
-#include "mozilla/Snprintf.h"
 
 // Undo the damage done by mozzconf.h
 #undef compress
 
 // Logging seems to be somewhat broken on b2g.
 #ifdef MOZ_B2G
 #define IPC_LOG(...)
 #else
@@ -516,16 +517,21 @@ MessageChannel::MessageChannel(MessageLi
 }
 
 MessageChannel::~MessageChannel()
 {
     MOZ_COUNT_DTOR(ipc::MessageChannel);
     IPC_ASSERT(mCxxStackFrames.empty(), "mismatched CxxStackFrame ctor/dtors");
 #ifdef OS_WIN
     BOOL ok = CloseHandle(mEvent);
+    if (!ok) {
+        gfxDevCrash(mozilla::gfx::LogReason::MessageChannelCloseFailure) <<
+            "MessageChannel failed to close. GetLastError: " <<
+            GetLastError();
+    }
     MOZ_RELEASE_ASSERT(ok);
 #endif
     Clear();
 }
 
 // This function returns the current transaction ID. Since the notion of a
 // "current transaction" can be hard to define when messages race with each
 // other and one gets canceled and the other doesn't, we require that this