Closed Bug 1237690 Opened 5 years ago Closed 5 years ago
Deadlock in ns
App Shell::Sync Run Event
Bug 1233812 introduced a possible deadlock in nsAppShell::SyncRunEvent. When we're waiting on the event in the source thread, we're holding onto sAppShellLock, but that prevents another thread from taking that lock. If that other thread is the Gecko thread, there will be a deadlock, because the event never gets run so sAppShellLock never gets released.
In order to prevent the deadlock, we need to release sAppShellLock when we start waiting in SyncRunEvent. However, we cannot simply unlock it before the wait because that introduces an out-of-order unlocking wrt mSyncRunMonitor, which can cause further deadlocks. So this patch converts mSyncRunMoitor to a condvar and make it use sAppShellLock. That then involves making aAppShellLock a Mutex instead of a StaticMutex. The final result is having one lock (sAppShellLock), which supports any other condvars that we have, such as mSyncRunFinished.
Attachment #8705268 - Flags: review?(snorp)
Attachment #8705268 - Flags: review?(snorp) → review+
You need to log in before you can comment on or make changes to this bug.