Closed
Bug 1229153
Opened 9 years ago
Closed 9 years ago
crash in java.lang.IllegalStateException: Callback has already been executed for type=Snackbar:Show
Categories
(Firefox for Android Graveyard :: General, defect)
Firefox for Android Graveyard
General
Tracking
(firefox44+ verified, firefox45+ verified, firefox46 verified, fennec44+)
VERIFIED
FIXED
Firefox 46
People
(Reporter: jchen, Assigned: sebastian)
References
Details
(Keywords: crash)
Crash Data
Attachments
(2 files)
40 bytes,
text/x-review-board-request
|
jchen
:
review+
ritu
:
approval-mozilla-aurora+
ritu
:
approval-mozilla-beta+
|
Details |
1.05 KB,
patch
|
Details | Diff | Splinter Review |
This bug was filed from the Socorro interface and is
report bp-1ad7a9f6-c905-4c05-a773-a14b82151129.
=============================================================
STR:
* Display a snackbar (e.g. by closing a tab)
* Press the home button to background Fennec
Comment 1•9 years ago
|
||
[Tracking Requested - why for this release]: regresssion
tracking-fennec: --- → ?
status-firefox44:
--- → affected
status-firefox45:
--- → affected
tracking-firefox44:
--- → ?
tracking-firefox45:
--- → ?
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → s.kaspari
Assignee | ||
Comment 2•9 years ago
|
||
(In reply to Jim Chen [:jchen] [:darchons] from comment #0)
> STR:
> * Display a snackbar (e.g. by closing a tab)
> * Press the home button to background Fennec
I'm unable to reproduce this with the STR. Does this happen every time?
The crash reports point to 44.0a2. Aurora only shows a snackbar when closing a tab.
Assignee | ||
Comment 3•9 years ago
|
||
I wonder how this can happen. To avoid this I synchronized onClick() and onDismiss() to invoke the callback only once:
https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoApp.java?from=GeckoApp.java#880-898
Reporter | ||
Comment 4•9 years ago
|
||
Not every time, but I can reproduce in today's Nightly on a Nexus 4 running 4.4.2. I think this is a more reliable STR:
1. Turn on "Don't Keep Activities" in Developer options
2. Start Fennec
3. Close the about:home tab
4. Press Home button to background Fennec immediately, *while the snackbar is displayed*
5. Go back to Fennec
6. Repeat steps 3 and 4
7. Crash after waiting a few second (< 10 seconds)
I was a little puzzled too on why it's happening after scanning through the code.
Tracked since it's a reproducible crash.
Updated•9 years ago
|
tracking-fennec: ? → 44+
Assignee | ||
Comment 6•9 years ago
|
||
(In reply to Jim Chen [:jchen] [:darchons] from comment #4)
> 1. Turn on "Don't Keep Activities" in Developer options
With this developer setting I can see this happening too sometimes. I'll debug what's happening here..
Assignee | ||
Comment 7•9 years ago
|
||
What I see happening here is that GeckoApp.handleMessage() is called twice for "Snackbar:Show" - with the same callback (Not always but quite often). So we are actually trying to show two Snackbars. This is happening so fast that the first snackbar is dismissed instantly. Later when the second snackbar is dismissed we are calling the same callback again: IllegalStateException: Callback has already been executed.
Assignee | ||
Comment 8•9 years ago
|
||
Going deeper:
* Snackbar.jsm sends the event only once
* In EventDispatcher BrowserApp is registered twice for the event
* handleMessage() on BrowserApp is called twice.
Assignee | ||
Comment 9•9 years ago
|
||
Woah, I just realized we register for Snackbar:Show events but we never unregister. Therefore EventDispatcher will hold references to all BrowserApp instances that ever existed and routes Snackbar events to them.
Assignee | ||
Comment 10•9 years ago
|
||
Bug 1229153 - GeckoApp: Unregister from Snackbar events in onDestroy(). r?jchen
Attachment #8697284 -
Flags: review?(nchen)
Assignee | ||
Comment 11•9 years ago
|
||
In addition to the patch here I wonder:
* Should EventDispatcher use SoftReferences[1] so that the reference can be cleared if only EventDispatcher holds one?
* Does it make sense to pass the same EventCallback to all listeners? A listener can not know if another listener has already invoked this callback. But maybe we currently just do not have multiple listeners that might invoke (the same) callbacks.
[1] http://developer.android.com/reference/java/lang/ref/SoftReference.html
Flags: needinfo?(nchen)
Reporter | ||
Updated•9 years ago
|
Attachment #8697284 -
Flags: review?(nchen) → review+
Reporter | ||
Comment 12•9 years ago
|
||
Comment on attachment 8697284 [details]
MozReview Request: Bug 1229153 - GeckoApp: Unregister from Snackbar events in onDestroy(). r?jchen
https://reviewboard.mozilla.org/r/27541/#review24811
Reporter | ||
Comment 13•9 years ago
|
||
(In reply to Sebastian Kaspari (:sebastian) from comment #11)
> In addition to the patch here I wonder:
>
> * Should EventDispatcher use SoftReferences[1] so that the reference can be
> cleared if only EventDispatcher holds one?
I see an advantage in using SoftReferences if we have a consumer that has complex lifecycle (i.e. it cannot call unregisterListener reliably). For BrowserApp, its lifecycle is well-defined, so we should just make sure we call unregisterListener. What do you think?
> * Does it make sense to pass the same EventCallback to all listeners? A
> listener can not know if another listener has already invoked this callback.
> But maybe we currently just do not have multiple listeners that might invoke
> (the same) callbacks.
I think a lot of the JS code assumes the callback is only called once, so even if we allow multiple listeners to have separate callbacks, the JS side probably won't support it very well.
Flags: needinfo?(nchen)
Assignee | ||
Comment 14•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/c2de784e68f7348720cc336438b6c5ec9e3acc1c
Bug 1229153 - GeckoApp: Unregister from Snackbar events in onDestroy(). r=jchen
Assignee | ||
Comment 15•9 years ago
|
||
NI to myself: This needs uplifting. But today is merge day so I need to figure out what branches/versions need the patch tomorrow.
Flags: needinfo?(s.kaspari)
Comment 16•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox46:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 46
Assignee | ||
Comment 17•9 years ago
|
||
Comment on attachment 8697284 [details]
MozReview Request: Bug 1229153 - GeckoApp: Unregister from Snackbar events in onDestroy(). r?jchen
Approval Request Comment
[Feature/regressing bug #]: Regression introduced with the introduction of the snackbar (bug 1215026; meta bug 1157526)
[User impact if declined]: App might crash after resuming the app multiple times and a snackbar is shown. This regression can have negative impact on memory consumption too because it prevents previous activities from being freed.
[Describe test coverage new/current, TreeHerder]: Local testing, very simple patch.
[Risks and why]: Very low risk. We registered for an event and never unregistered. This patch adds the call to unregister.
[String/UUID change made/needed]: -
Flags: needinfo?(s.kaspari)
Attachment #8697284 -
Flags: approval-mozilla-beta?
Attachment #8697284 -
Flags: approval-mozilla-aurora?
Comment on attachment 8697284 [details]
MozReview Request: Bug 1229153 - GeckoApp: Unregister from Snackbar events in onDestroy(). r?jchen
Crash fix, taking it on Aurora45 and Beta44.
Attachment #8697284 -
Flags: approval-mozilla-beta?
Attachment #8697284 -
Flags: approval-mozilla-beta+
Attachment #8697284 -
Flags: approval-mozilla-aurora?
Attachment #8697284 -
Flags: approval-mozilla-aurora+
This is causing conflicts trying to uplift to aurora and beta due to a lack of bug 1107811. Can we either get a rebased patch for uplift or request 1107811 gets uplifted first to make this apply correctly?
Flags: needinfo?(s.kaspari)
Assignee | ||
Comment 20•9 years ago
|
||
I'll prepare a patch that applies cleanly to aurora and beta.
However I'll also NI nalexander: Do you think we should consider uplifting bug 1107811? Maybe this will reduce the amount of work for future patch uplifts? But I'm not sure how isolated the changes in bug 1107811 are.
Flags: needinfo?(nalexander)
Assignee | ||
Comment 21•9 years ago
|
||
This is the patch for beta. For aurora it seems like we do not need a separate patch: The changes in bug 1107811 are in aurora. So the existing patch should apply cleanly.
Flags: needinfo?(s.kaspari) → needinfo?(wkocher)
Comment 22•9 years ago
|
||
(In reply to Sebastian Kaspari (:sebastian) from comment #20)
> I'll prepare a patch that applies cleanly to aurora and beta.
>
> However I'll also NI nalexander: Do you think we should consider uplifting
> bug 1107811? Maybe this will reduce the amount of work for future patch
> uplifts? But I'm not sure how isolated the changes in bug 1107811 are.
The changes are perfectly isolated: there should be no changes to the generated .class files.
Since hg has no knowledge of directories, you might need to run some follow-up |hg mv| commands, or re-run the commands (in the commit messages). I can take this task if we want it.
Flags: needinfo?(nalexander)
Comment 23•9 years ago
|
||
bugherder uplift |
Comment 24•9 years ago
|
||
Verified as fixed on Firefox 44 Beta 1 on Alcatel One Touch 8008D following the STR from Comment 4
Flags: needinfo?(wkocher)
Comment 25•9 years ago
|
||
bugherder uplift |
Comment 26•9 years ago
|
||
Verified as fixed using steps from comment 4:
Device: Nexus 6 (Android 6.0)
Build: Firefox for Android 46.0a1 (2015-12-22)
Comment 27•9 years ago
|
||
Verified as fixed using steps from comment 4:
Device: Nexus 6 (Android 6.0)
Build: Firefox for Android 45.0a2 (2015-12-23)
Status: RESOLVED → VERIFIED
Updated•9 years ago
|
Updated•4 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
•