Closed Bug 772643 Opened 9 years ago Closed 9 years ago

Chrome hang monitor can deadlock the browser

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: khuey, Unassigned)

Details

(Whiteboard: [ironic])

Attachments

(1 file)

The chrome hang monitor suspends the hung thread, walks its stack, and then resumes the thread (http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/HangMonitor.cpp#122).

This falls down if the suspended thread holds the allocator lock.  When the stack walker tries to malloc at http://mxr.mozilla.org/mozilla-central/source/xpcom/threads/HangMonitor.cpp#114, we deadlock.  I hit this on my local machine today.
Comment on attachment 640811 [details] [diff] [review]
Don't allocate memory while a thread is suspended

Review of attachment 640811 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/threads/HangMonitor.cpp
@@ +123,5 @@
>    MOZ_ASSERT(winMainThreadHandle);
> +
> +  // The thread we're about to suspend might have the alloc lock
> +  // so allocate ahead of time
> +  callStack.SetCapacity(400);

Nit: Please make this a static const with a sensible name and put it perhaps after line 23.
Attachment #640811 - Flags: review?(ehsan) → review+
Attachment #640811 - Flags: checkin+
https://hg.mozilla.org/mozilla-central/rev/45c7c796fd81
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Whiteboard: [ironic]
You need to log in before you can comment on or make changes to this bug.