Bug 1237458 - Use MOZ_RELEASE_ASSERT for IPC assertions (r=jld)
authorBill McCloskey <billm@mozilla.com>
Thu, 04 Feb 2016 16:09:11 -0800
changeset 283284 734e3856f443e0b7e65f017483a8a7a8abf6b5b2
parent 283283 6515133eb2527ed9904d36da3caaf4a9fc3180d3
child 283285 5cea9a9062423573219510bfc4d3f7a24b513cf2
push id29976
push userphilringnalda@gmail.com
push dateSat, 06 Feb 2016 02:42:05 +0000
treeherdermozilla-central@0885625045f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld
bugs1237458
milestone47.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 1237458 - Use MOZ_RELEASE_ASSERT for IPC assertions (r=jld)
ipc/glue/MessageChannel.cpp
ipc/glue/MessageChannel.h
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -144,34 +144,34 @@ public:
       : mMessageName(msg->name()),
         mMessageRoutingId(msg->routing_id()),
         mMesageSemantics(msg->is_interrupt() ? INTR_SEMS :
                           msg->is_sync() ? SYNC_SEMS :
                           ASYNC_SEMS),
         mDirection(direction),
         mMoved(false)
     {
-        MOZ_ASSERT(mMessageName);
+        MOZ_RELEASE_ASSERT(mMessageName);
     }
 
     InterruptFrame(InterruptFrame&& aOther)
     {
-        MOZ_ASSERT(aOther.mMessageName);
+        MOZ_RELEASE_ASSERT(aOther.mMessageName);
         mMessageName = aOther.mMessageName;
         aOther.mMessageName = nullptr;
         aOther.mMoved = true;
 
         mMessageRoutingId = aOther.mMessageRoutingId;
         mMesageSemantics = aOther.mMesageSemantics;
         mDirection = aOther.mDirection;
     }
 
     ~InterruptFrame()
     {
-        MOZ_ASSERT_IF(!mMessageName, mMoved);
+        MOZ_RELEASE_ASSERT(mMessageName || mMoved);
     }
 
     InterruptFrame& operator=(InterruptFrame&& aOther)
     {
         MOZ_RELEASE_ASSERT(&aOther != this);
         this->~InterruptFrame();
         new (this) InterruptFrame(mozilla::Move(aOther));
         return *this;
@@ -208,17 +208,17 @@ public:
         return mMessageRoutingId;
     }
 
 private:
     const char* mMessageName;
     int32_t mMessageRoutingId;
     Semantics mMesageSemantics;
     Direction mDirection;
-    DebugOnly<bool> mMoved;
+    bool mMoved;
 
     // Disable harmful methods.
     InterruptFrame(const InterruptFrame& aOther) = delete;
     InterruptFrame& operator=(const InterruptFrame&) = delete;
 };
 
 class MOZ_STACK_CLASS MessageChannel::CxxStackFrame
 {
@@ -243,17 +243,17 @@ public:
             mThat.EnteredSyncSend();
 
         mThat.mSawInterruptOutMsg |= frame.IsInterruptOutcall();
     }
 
     ~CxxStackFrame() {
         mThat.AssertWorkerThread();
 
-        MOZ_ASSERT(!mThat.mCxxStackFrames.empty());
+        MOZ_RELEASE_ASSERT(!mThat.mCxxStackFrames.empty());
 
         const InterruptFrame& frame = mThat.mCxxStackFrames.back();
         bool exitingSync = frame.IsOutgoingSync();
         bool exitingCall = frame.IsInterruptIncall();
         mThat.mCxxStackFrames.shrinkBy(1);
 
         bool exitingStack = mThat.mCxxStackFrames.empty();
 
@@ -323,27 +323,27 @@ MessageChannel::MessageChannel(MessageLi
                                                  &MessageChannel::OnMaybeDequeueOne));
 
     mOnChannelConnectedTask = new RefCountedTask(NewRunnableMethod(
         this,
         &MessageChannel::DispatchOnChannelConnected));
 
 #ifdef OS_WIN
     mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
-    NS_ASSERTION(mEvent, "CreateEvent failed! Nothing is going to work!");
+    MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
 #endif
 }
 
 MessageChannel::~MessageChannel()
 {
     MOZ_COUNT_DTOR(ipc::MessageChannel);
     IPC_ASSERT(mCxxStackFrames.empty(), "mismatched CxxStackFrame ctor/dtors");
 #ifdef OS_WIN
-    DebugOnly<BOOL> ok = CloseHandle(mEvent);
-    MOZ_ASSERT(ok);
+    BOOL ok = CloseHandle(mEvent);
+    MOZ_RELEASE_ASSERT(ok);
 #endif
     Clear();
 }
 
 static void
 PrintErrorMessage(Side side, const char* channelName, const char* msg)
 {
     const char *from = (side == ChildSide)
@@ -461,35 +461,35 @@ MessageChannel::Open(MessageChannel *aTa
     MonitorAutoLock lock(*mMonitor);
     mChannelState = ChannelOpening;
     aTargetLoop->PostTask(
         FROM_HERE,
         NewRunnableMethod(aTargetChan, &MessageChannel::OnOpenAsSlave, this, oppSide));
 
     while (ChannelOpening == mChannelState)
         mMonitor->Wait();
-    NS_ASSERTION(ChannelConnected == mChannelState, "not connected when awoken");
+    MOZ_RELEASE_ASSERT(ChannelConnected == mChannelState, "not connected when awoken");
     return (ChannelConnected == mChannelState);
 }
 
 void
 MessageChannel::OnOpenAsSlave(MessageChannel *aTargetChan, Side aSide)
 {
     // Invoked when the other side has begun the open.
     NS_PRECONDITION(ChannelClosed == mChannelState,
                     "Not currently closed");
     NS_PRECONDITION(ChannelOpening == aTargetChan->mChannelState,
                     "Target channel not in the process of opening");
 
     CommonThreadOpenInit(aTargetChan, aSide);
     mMonitor = aTargetChan->mMonitor;
 
     MonitorAutoLock lock(*mMonitor);
-    NS_ASSERTION(ChannelOpening == aTargetChan->mChannelState,
-                 "Target channel not in the process of opening");
+    MOZ_RELEASE_ASSERT(ChannelOpening == aTargetChan->mChannelState,
+                          "Target channel not in the process of opening");
     mChannelState = ChannelConnected;
     aTargetChan->mChannelState = ChannelConnected;
     aTargetChan->mMonitor->Notify();
 }
 
 void
 MessageChannel::CommonThreadOpenInit(MessageChannel *aTargetChan, Side aSide)
 {
@@ -591,17 +591,17 @@ MessageChannel::ShouldDeferMessage(const
     // Never defer messages that have the highest priority, even async
     // ones. This is safe because only the child can send these messages, so
     // they can never nest.
     if (aMsg.priority() == IPC::Message::PRIORITY_URGENT)
         return false;
 
     // Unless they're urgent, we always defer async messages.
     if (!aMsg.is_sync()) {
-        MOZ_ASSERT(aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
+        MOZ_RELEASE_ASSERT(aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
         return true;
     }
 
     int msgPrio = aMsg.priority();
     int waitingPrio = AwaitingSyncReplyPriority();
 
     // Always defer if the priority of the incoming message is less than the
     // priority of the message we're awaiting.
@@ -653,20 +653,20 @@ MessageChannel::OnMessageReceivedFromLin
 
         if (aMsg.seqno() == mTimedOutMessageSeqno) {
             // Drop the message, but allow future sync messages to be sent.
             IPC_LOG("Received reply to timedout message; igoring; xid=%d", mTimedOutMessageSeqno);
             EndTimeout();
             return;
         }
 
-        MOZ_ASSERT(aMsg.transaction_id() == mCurrentTransaction);
-        MOZ_ASSERT(AwaitingSyncReply());
-        MOZ_ASSERT(!mRecvd);
-        MOZ_ASSERT(!mTimedOutMessageSeqno);
+        MOZ_RELEASE_ASSERT(aMsg.transaction_id() == mCurrentTransaction);
+        MOZ_RELEASE_ASSERT(AwaitingSyncReply());
+        MOZ_RELEASE_ASSERT(!mRecvd);
+        MOZ_RELEASE_ASSERT(!mTimedOutMessageSeqno);
 
         // Rather than storing errors in mRecvd, we mark them in
         // mRecvdErrors. We need a counter because multiple replies can arrive
         // when a timeout happens, as in the following example. Imagine the
         // child is running slowly. The parent sends a sync message P1. It times
         // out. The child eventually sends a sync message C1. While waiting for
         // the C1 response, the child dispatches P1. In doing so, it sends sync
         // message C2. At that point, it's valid for the parent to send error
@@ -678,43 +678,43 @@ MessageChannel::OnMessageReceivedFromLin
         }
 
         mRecvd = new Message(aMsg);
         NotifyWorkerThread();
         return;
     }
 
     // Prioritized messages cannot be compressed.
-    MOZ_ASSERT_IF(aMsg.compress_type() != IPC::Message::COMPRESSION_NONE,
-                  aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
+    MOZ_RELEASE_ASSERT(aMsg.compress_type() == IPC::Message::COMPRESSION_NONE ||
+                          aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
 
     bool compress = false;
     if (aMsg.compress_type() == IPC::Message::COMPRESSION_ENABLED) {
         compress = (!mPending.empty() &&
                     mPending.back().type() == aMsg.type() &&
                     mPending.back().routing_id() == aMsg.routing_id());
         if (compress) {
             // This message type has compression enabled, and the back of the
             // queue was the same message type and routed to the same destination.
             // Replace it with the newer message.
-            MOZ_ASSERT(mPending.back().compress_type() ==
-                       IPC::Message::COMPRESSION_ENABLED);
+            MOZ_RELEASE_ASSERT(mPending.back().compress_type() ==
+                                  IPC::Message::COMPRESSION_ENABLED);
             mPending.pop_back();
         }
     } else if (aMsg.compress_type() == IPC::Message::COMPRESSION_ALL) {
         // Check the message queue for another message with this type/destination.
         auto it = std::find_if(mPending.rbegin(), mPending.rend(),
                                MatchingKinds(aMsg.type(), aMsg.routing_id()));
         if (it != mPending.rend()) {
             // This message type has compression enabled, and the queue holds
             // a message with the same message type and routed to the same destination.
             // Erase it.  Note that, since we always compress these redundancies, There Can
             // Be Only One.
             compress = true;
-            MOZ_ASSERT((*it).compress_type() == IPC::Message::COMPRESSION_ALL);
+            MOZ_RELEASE_ASSERT((*it).compress_type() == IPC::Message::COMPRESSION_ALL);
             mPending.erase((++it).base());
         }
     }
 
     bool wakeUpSyncSend = AwaitingSyncReply() && !ShouldDeferMessage(aMsg);
 
     bool shouldWakeUp = AwaitingInterruptReply() ||
                         wakeUpSyncSend ||
@@ -782,18 +782,18 @@ MessageChannel::ProcessPendingRequests(i
             return;
         }
 
         mozilla::Vector<Message> toProcess;
 
         for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); ) {
             Message &msg = *it;
 
-            MOZ_ASSERT(mCurrentTransaction == transaction,
-                       "Calling ShouldDeferMessage when cancelled");
+            MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction,
+                                  "Calling ShouldDeferMessage when cancelled");
             bool defer = ShouldDeferMessage(msg);
 
             // Only log the interesting messages.
             if (msg.is_sync() || msg.priority() == IPC::Message::PRIORITY_URGENT) {
                 IPC_LOG("ShouldDeferMessage(seqno=%d) = %d", msg.seqno(), defer);
             }
 
             if (!defer) {
@@ -878,27 +878,27 @@ MessageChannel::Send(Message* aMsg, Mess
 
     if (mCurrentTransaction &&
         (DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_URGENT ||
          DispatchingAsyncMessagePriority() == IPC::Message::PRIORITY_URGENT))
     {
         // Generally only the parent dispatches urgent messages. And the only
         // sync messages it can send are high-priority. Mainly we want to ensure
         // here that we don't return false for non-CPOW messages.
-        MOZ_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH);
+        MOZ_RELEASE_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH);
         IPC_LOG("Sending while dispatching urgent message");
         mLastSendError = SyncSendError::SendingCPOWWhileDispatchingUrgent;
         return false;
     }
 
     if (mCurrentTransaction &&
         (msg->priority() < DispatchingSyncMessagePriority() ||
          msg->priority() < AwaitingSyncReplyPriority()))
     {
-        MOZ_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
+        MOZ_RELEASE_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
         IPC_LOG("Cancel from Send");
         CancelMessage *cancel = new CancelMessage(mCurrentTransaction);
         CancelTransaction(mCurrentTransaction);
         mLink->SendMessage(cancel);
     }
 
     IPC_ASSERT(msg->is_sync(), "can only Send() sync messages here");
 
@@ -919,17 +919,17 @@ MessageChannel::Send(Message* aMsg, Mess
         mLastSendError = SyncSendError::NotConnectedBeforeSend;
         return false;
     }
 
     msg->set_seqno(NextSeqno());
 
     int32_t seqno = msg->seqno();
     int prio = msg->priority();
-    DebugOnly<msgid_t> replyType = msg->type() + 1;
+    msgid_t replyType = msg->type() + 1;
 
     AutoSetValue<bool> replies(mAwaitingSyncReply, true);
     AutoSetValue<int> prioSet(mAwaitingSyncReplyPriority, prio);
     AutoEnterTransaction transact(this, seqno);
 
     int prios = mPendingSendPriorities | (1 << prio);
     AutoSetValue<int> priosSet(mPendingSendPriorities, prios);
 
@@ -962,19 +962,19 @@ MessageChannel::Send(Message* aMsg, Mess
             return false;
         }
 
         if (mRecvd) {
             IPC_LOG("Got reply: seqno=%d, xid=%d", seqno, transaction);
             break;
         }
 
-        MOZ_ASSERT(!mTimedOutMessageSeqno);
+        MOZ_RELEASE_ASSERT(!mTimedOutMessageSeqno);
 
-        MOZ_ASSERT(mCurrentTransaction == transaction);
+        MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction);
         bool maybeTimedOut = !WaitForSyncNotify(handleWindowsMessages);
 
         if (!Connected()) {
             ReportConnectionError("MessageChannel::SendAndWait");
             mLastSendError = SyncSendError::DisconnectedDuringSend;
             return false;
         }
 
@@ -1010,22 +1010,22 @@ MessageChannel::Send(Message* aMsg, Mess
 
             mTimedOutMessageSeqno = seqno;
             mTimedOutMessagePriority = prio;
             mLastSendError = SyncSendError::TimedOut;
             return false;
         }
     }
 
-    MOZ_ASSERT(mRecvd);
-    MOZ_ASSERT(mRecvd->is_reply(), "expected reply");
-    MOZ_ASSERT(!mRecvd->is_reply_error());
-    MOZ_ASSERT(mRecvd->type() == replyType, "wrong reply type");
-    MOZ_ASSERT(mRecvd->seqno() == seqno);
-    MOZ_ASSERT(mRecvd->is_sync());
+    MOZ_RELEASE_ASSERT(mRecvd);
+    MOZ_RELEASE_ASSERT(mRecvd->is_reply(), "expected reply");
+    MOZ_RELEASE_ASSERT(!mRecvd->is_reply_error());
+    MOZ_RELEASE_ASSERT(mRecvd->seqno() == seqno);
+    MOZ_RELEASE_ASSERT(mRecvd->type() == replyType, "wrong reply type");
+    MOZ_RELEASE_ASSERT(mRecvd->is_sync());
 
     *aReply = Move(*mRecvd);
     mRecvd = nullptr;
     mLastSendError = SyncSendError::SendSuccess;
     return true;
 }
 
 bool
@@ -1343,17 +1343,17 @@ MessageChannel::OnMaybeDequeueOne()
     if (IsOnCxxStack() && recvd.is_interrupt() && recvd.is_reply()) {
         // We probably just received a reply in a nested loop for an
         // Interrupt call sent before entering that loop.
         mOutOfTurnReplies[recvd.seqno()] = Move(recvd);
         return false;
     }
 
     // We should not be in a transaction yet if we're not blocked.
-    MOZ_ASSERT(mCurrentTransaction == 0);
+    MOZ_RELEASE_ASSERT(mCurrentTransaction == 0);
     DispatchMessage(recvd);
 
     return true;
 }
 
 void
 MessageChannel::DispatchMessage(const Message &aMsg)
 {
@@ -1364,17 +1364,17 @@ MessageChannel::DispatchMessage(const Me
     nsAutoPtr<Message> reply;
 
     IPC_LOG("DispatchMessage: seqno=%d, xid=%d", aMsg.seqno(), aMsg.transaction_id());
 
     {
         AutoEnterTransaction transaction(this, aMsg);
 
         int id = aMsg.transaction_id();
-        MOZ_ASSERT_IF(aMsg.is_sync(), id == mCurrentTransaction);
+        MOZ_RELEASE_ASSERT(!aMsg.is_sync() || id == mCurrentTransaction);
 
         {
             MonitorAutoUnlock unlock(*mMonitor);
             CxxStackFrame frame(*this, IN_MESSAGE, &aMsg);
 
             if (aMsg.is_sync())
                 DispatchSyncMessage(aMsg, *getter_Transfers(reply));
             else if (aMsg.is_interrupt())
@@ -1396,17 +1396,17 @@ MessageChannel::DispatchMessage(const Me
 
 void
 MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply)
 {
     AssertWorkerThread();
 
     int prio = aMsg.priority();
 
-    MOZ_ASSERT_IF(prio > IPC::Message::PRIORITY_NORMAL, NS_IsMainThread());
+    MOZ_RELEASE_ASSERT(prio == IPC::Message::PRIORITY_NORMAL || NS_IsMainThread());
 
     MessageChannel* dummy;
     MessageChannel*& blockingVar = mSide == ChildSide && NS_IsMainThread() ? gParentProcessBlocker : dummy;
 
     Result rv;
     {
         AutoSetValue<MessageChannel*> blocked(blockingVar, this);
         AutoSetValue<bool> sync(mDispatchingSyncMessage, true);
@@ -1424,17 +1424,17 @@ MessageChannel::DispatchSyncMessage(cons
     aReply->set_seqno(aMsg.seqno());
     aReply->set_transaction_id(aMsg.transaction_id());
 }
 
 void
 MessageChannel::DispatchAsyncMessage(const Message& aMsg)
 {
     AssertWorkerThread();
-    MOZ_ASSERT(!aMsg.is_interrupt() && !aMsg.is_sync());
+    MOZ_RELEASE_ASSERT(!aMsg.is_interrupt() && !aMsg.is_sync());
 
     if (aMsg.routing_id() == MSG_ROUTING_NONE) {
         NS_RUNTIMEABORT("unhandled special message!");
     }
 
     Result rv;
     {
         int prio = aMsg.priority();
@@ -1543,17 +1543,17 @@ MessageChannel::MaybeUndeferIncall()
     // maybe time to process this message
     Message call = mDeferred.top();
     mDeferred.pop();
 
     // fix up fudge factor we added to account for race
     IPC_ASSERT(0 < mRemoteStackDepthGuess, "fatal logic error");
     --mRemoteStackDepthGuess;
 
-    MOZ_ASSERT(call.priority() == IPC::Message::PRIORITY_NORMAL);
+    MOZ_RELEASE_ASSERT(call.priority() == IPC::Message::PRIORITY_NORMAL);
     mPending.push_back(call);
 }
 
 void
 MessageChannel::FlushPendingInterruptQueue()
 {
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
@@ -1692,27 +1692,27 @@ MessageChannel::SetReplyTimeoutMs(int32_
     mTimeoutMs = (aTimeoutMs <= 0)
                  ? kNoTimeout
                  : (int32_t)ceil((double)aTimeoutMs / 2.0);
 }
 
 void
 MessageChannel::OnChannelConnected(int32_t peer_id)
 {
-    MOZ_ASSERT(!mPeerPidSet);
+    MOZ_RELEASE_ASSERT(!mPeerPidSet);
     mPeerPidSet = true;
     mPeerPid = peer_id;
     mWorkerLoop->PostTask(FROM_HERE, new DequeueTask(mOnChannelConnectedTask));
 }
 
 void
 MessageChannel::DispatchOnChannelConnected()
 {
     AssertWorkerThread();
-    MOZ_ASSERT(mPeerPidSet);
+    MOZ_RELEASE_ASSERT(mPeerPidSet);
     if (mListener)
         mListener->OnChannelConnected(mPeerPid);
 }
 
 void
 MessageChannel::ReportMessageRouteError(const char* channelName) const
 {
     PrintErrorMessage(mSide, channelName, "Need a route");
@@ -2056,17 +2056,17 @@ MessageChannel::DumpInterruptStack(const
         printf_stderr("%s[(%u) %s %s %s(actor=%d) ]\n", pfx,
                       i, dir, sems, name, id);
     }
 }
 
 int32_t
 MessageChannel::GetTopmostMessageRoutingId() const
 {
-    MOZ_ASSERT(MessageLoop::current() == mWorkerLoop);
+    MOZ_RELEASE_ASSERT(MessageLoop::current() == mWorkerLoop);
     if (mCxxStackFrames.empty()) {
         return MSG_ROUTING_NONE;
     }
     const InterruptFrame& frame = mCxxStackFrames.back();
     return frame.GetRoutingId();
 }
 
 void
@@ -2142,43 +2142,43 @@ MessageChannel::CancelTransaction(int tr
         IPC_LOG("Cancelled timed out message %d", mTimedOutMessageSeqno);
         EndTimeout();
 
         // Normally mCurrentTransaction == 0 here. But it can be non-zero if:
         // 1. Parent sends hi prio message H.
         // 2. Parent times out H.
         // 3. Child dispatches H and sends nested message H' (same transaction).
         // 4. Parent dispatches H' and cancels.
-        MOZ_ASSERT_IF(mCurrentTransaction, mCurrentTransaction == transaction);
+        MOZ_RELEASE_ASSERT(!mCurrentTransaction || mCurrentTransaction == transaction);
         mCurrentTransaction = 0;
 
         // During a timeout Send should always fail.
-        MOZ_ASSERT(!mAwaitingSyncReply);
+        MOZ_RELEASE_ASSERT(!mAwaitingSyncReply);
     } else {
-        MOZ_ASSERT(mCurrentTransaction == transaction);
+        MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction);
         mCurrentTransaction = 0;
 
         mAwaitingSyncReply = false;
         mAwaitingSyncReplyPriority = 0;
     }
 
-    DebugOnly<bool> foundSync = false;
+    bool foundSync = false;
     for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); ) {
         Message &msg = *it;
 
         // If there was a race between the parent and the child, then we may
         // have a queued sync message. We want to drop this message from the
         // queue since it will get cancelled along with the transaction being
         // cancelled. We don't bother doing this for normal priority messages
         // because the child is just going to crash in that case, and we want to
         // avoid processing messages out of order in the short time before it
         // crashes.
         if (msg.is_sync() && msg.priority() != IPC::Message::PRIORITY_NORMAL) {
-            MOZ_ASSERT(!foundSync);
-            MOZ_ASSERT(msg.transaction_id() != transaction);
+            MOZ_RELEASE_ASSERT(!foundSync);
+            MOZ_RELEASE_ASSERT(msg.transaction_id() != transaction);
             IPC_LOG("Removing msg from queue seqno=%d xid=%d", msg.seqno(), msg.transaction_id());
             foundSync = true;
             it = mPending.erase(it);
             continue;
         }
 
         // There may be messages in the queue that we expected to process from
         // ProcessPendingRequests. However, Send will no longer call that
@@ -2202,17 +2202,17 @@ MessageChannel::CancelCurrentTransaction
     if (mCurrentTransaction) {
         if (DispatchingSyncMessagePriority() == IPC::Message::PRIORITY_URGENT ||
             DispatchingAsyncMessagePriority() == IPC::Message::PRIORITY_URGENT)
         {
             mListener->IntentionalCrash();
         }
 
         IPC_LOG("Cancel requested: current xid=%d", mCurrentTransaction);
-        MOZ_ASSERT(DispatchingSyncMessage());
+        MOZ_RELEASE_ASSERT(DispatchingSyncMessage());
         CancelMessage *cancel = new CancelMessage(mCurrentTransaction);
         CancelTransaction(mCurrentTransaction);
         mLink->SendMessage(cancel);
     }
 }
 
 void
 CancelCPOWs()
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -619,18 +619,19 @@ class MessageChannel : HasResultCodes
           mNewTransaction(aMessage.transaction_id()),
           mOldTransaction(mChan->mCurrentTransaction)
        {
            mChan->mMonitor->AssertCurrentThreadOwns();
 
            if (!aMessage.is_sync())
                return;
 
-           MOZ_ASSERT_IF(mChan->mSide == ParentSide && mOldTransaction != aMessage.transaction_id(),
-                         !mOldTransaction || aMessage.priority() > mChan->AwaitingSyncReplyPriority());
+           MOZ_DIAGNOSTIC_ASSERT(
+               !(mChan->mSide == ParentSide && mOldTransaction != aMessage.transaction_id()) ||
+               !mOldTransaction || aMessage.priority() > mChan->AwaitingSyncReplyPriority());
            mChan->mCurrentTransaction = aMessage.transaction_id();
        }
        ~AutoEnterTransaction() {
            mChan->mMonitor->AssertCurrentThreadOwns();
            if (mChan->mCurrentTransaction == mNewTransaction) {
                mChan->mCurrentTransaction = mOldTransaction;
            }
        }
@@ -771,17 +772,17 @@ class MessageChannel : HasResultCodes
 
     // See SetChannelFlags
     ChannelFlags mFlags;
 
     // Task and state used to asynchronously notify channel has been connected
     // safely.  This is necessary to be able to cancel notification if we are
     // closed at the same time.
     RefPtr<RefCountedTask> mOnChannelConnectedTask;
-    DebugOnly<bool> mPeerPidSet;
+    bool mPeerPidSet;
     int32_t mPeerPid;
 };
 
 void
 CancelCPOWs();
 
 } // namespace ipc
 } // namespace mozilla