Closed
Bug 889881
Opened 11 years ago
Closed 11 years ago
ANR: GeckoAppShell.pumpMessageLoop() can block the Gecko thread
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 25
People
(Reporter: jchen, Assigned: jchen)
Details
(Whiteboard: [ANR])
Attachments
(2 files)
6.63 KB,
patch
|
blassey
:
review+
|
Details | Diff | Splinter Review |
5.38 KB,
patch
|
blassey
:
review+
|
Details | Diff | Splinter Review |
GeckoAppShell.pumpMessageLoop() calls GeckoAppShell.getNextMessageFromQueue() through JNI to retrieve the next message from the Gecko thread message queue. Because we don't want MessageQueue.next() to block, getNextMessageFromQueue() bails if |MessageQueue.mMessages == null|. However that's not a reliable way to detect whether MessageQueue.next() will block or not, and it can still block if there are pending messages (e.g. delayed messages). Once MessageQueue.next() blocks, the Gecko thread is blocked, causing unresponsiveness and ANRs.
Assignee | ||
Comment 1•11 years ago
|
||
We first need a Gecko handler in order for the fix to work. This patch also moves setting the Gecko thread/handler to inside GeckoThread.
Attachment #770842 -
Flags: review?(blassey.bugs)
Assignee | ||
Comment 2•11 years ago
|
||
The fix here uses an IdleHandler to detect when MessageQueue.next() is going to block or not, instead of checking MessageQueue.mMessages. The IdleHandler cannot throw an Exception to prevent blocking, but it can queue a new, special message. This new message gets returned in MessageQueue.next() and we return early when we detect this message (this patch uses Message.obj to set/detect the special message).
Attachment #770844 -
Flags: review?(blassey.bugs)
Updated•11 years ago
|
Attachment #770842 -
Flags: review?(blassey.bugs) → review+
Comment 3•11 years ago
|
||
Comment on attachment 770844 [details] [diff] [review] Use IdleHandler to make MessageQueue.next() not block (v1) Review of attachment 770844 [details] [diff] [review]: ----------------------------------------------------------------- Not going to lie, there is some black magic in this code. Let's keep an eye out for flash bugs after this lands.
Attachment #770844 -
Flags: review?(blassey.bugs) → review+
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/66427620c3cd https://hg.mozilla.org/integration/mozilla-inbound/rev/487b02e3c084
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/66427620c3cd https://hg.mozilla.org/mozilla-central/rev/487b02e3c084
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Updated•3 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•