Last Comment Bug 784360 - java.util.ConcurrentModificationException: at java.util.HashMap$HashIterator.nextEntry( at org.mozilla.gecko.DoorHangerPopup.onTabChanged(
: java.util.ConcurrentModificationException: at java.util.HashMap$HashIterator....
: crash, regression, topcrash
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: 17 Branch
: ARM Android
-- critical (vote)
: Firefox 19
Assigned To: :Margaret Leibovic
: Sebastian Kaspari (:sebastian)
Depends on:
Blocks: 732336
  Show dependency treegraph
Reported: 2012-08-21 08:28 PDT by Scoobidiver (away)
Modified: 2013-01-02 14:29 PST (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (1.81 KB, patch)
2012-08-29 16:51 PDT, :Margaret Leibovic
wjohnston2000: review+
lukasblakk+bugs: approval‑mozilla‑aurora+
lukasblakk+bugs: approval‑mozilla‑beta+
Details | Diff | Splinter Review

Description User image Scoobidiver (away) 2012-08-21 08:28:24 PDT
It first appeared in 17.0a1/20120806. The regression range is likely:
It's likely a regression from bug 732336.

Here is a crash report: bp-28152574-c339-4b59-8b99-62f822120821.

	at java.util.HashMap$HashIterator.nextEntry(
	at java.util.HashMap$
	at org.mozilla.gecko.DoorHangerPopup.onTabChanged(
	at org.mozilla.gecko.Tabs.notifyListeners(
	at org.mozilla.gecko.Tabs.notifyListeners(
	at org.mozilla.gecko.Tabs$
	at android.os.Handler.handleCallback(
	at android.os.Handler.dispatchMessage(
	at android.os.Looper.loop(
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(
	at dalvik.system.NativeStart.main(Native Method)

More reports at:
Comment 1 User image :Margaret Leibovic 2012-08-29 16:51:06 PDT
Created attachment 656673 [details] [diff] [review]

Sigh, threads. I'm not sure if this is the smartest way to avoid a ConcurrentModificationException, but it's what we've done elsewhere. There are also things like CopyOnWriteArrayList, but that feels too heavyweight for this case.
Comment 2 User image Wesley Johnston (:wesj) 2012-09-11 17:03:17 PDT
Comment on attachment 656673 [details] [diff] [review]

Review of attachment 656673 [details] [diff] [review]:

I think it'd be cleaner to just use synchronized here. We aren't going to be doing so much with this list that I expect that to happen often. It matches well with the advice from here:

"A CopyOnWriteArrayList is preferable to a synchronized ArrayList when the expected number of reads and traversals greatly outnumber the number of updates to a list."
Comment 3 User image :Margaret Leibovic 2012-09-12 02:37:18 PDT
(In reply to Wesley Johnston (:wesj) from comment #2)

> I think it'd be cleaner to just use synchronized here.

Where would we use synchronized? I see above that I mentioned threads, but thinking about it more, the problem isn't that this is being accessed from multiple threads, the problem is that we're modifying the array as we're iterating over it. I've found I can reliably reproduce this crash if I close any tab that has multiple doorhangers (a good testcase is
Comment 4 User image :Margaret Leibovic 2012-09-21 11:58:11 PDT
Wes, poke. See comment 3.
Comment 5 User image Scoobidiver (away) 2012-10-14 02:03:13 PDT
It's #8 top crasher in 17.0b1.
Comment 6 User image :Margaret Leibovic 2012-10-15 10:36:02 PDT
Comment on attachment 656673 [details] [diff] [review]

Wes, can you re-review this? See comment 3.
Comment 7 User image Wesley Johnston (:wesj) 2012-10-15 10:39:24 PDT
Comment on attachment 656673 [details] [diff] [review]

Review of attachment 656673 [details] [diff] [review]:

Ok. I can live with this.
Comment 9 User image :Margaret Leibovic 2012-10-15 16:27:14 PDT
Comment on attachment 656673 [details] [diff] [review]

[Approval Request Comment]
Bug caused by (feature/regressing bug #): crash caused by bug 732336
User impact if declined: crash if you close a tab with multiple doorhanger notification messages
Testing completed (on m-c, etc.): just landed on inbound
Risk to taking this patch (and alternatives if risky): low-risk small self-contained change
String or UUID changes made by this patch: n/a
Comment 10 User image Ed Morley [:emorley] 2012-10-16 01:24:12 PDT
Comment 12 User image Kevin Brosnan [:kbrosnan] 2013-01-02 11:52:32 PST
This is still crashing on Firefox 17.
Comment 13 User image :Margaret Leibovic 2013-01-02 11:58:12 PST
(In reply to Kevin Brosnan [:kbrosnan] from comment #12)
> This is still crashing on Firefox 17.

The stacks for the recent crashes look different. I looked at the most recent 10, and they don't mention DoorHangerPopup at all. Please file a new bug.
Comment 14 User image Kevin Brosnan [:kbrosnan] 2013-01-02 14:29:10 PST
Verified then. I don't see any popup hanger crashes either.

Note You need to log in before you can comment on or make changes to this bug.