Closed Bug 1279488 Opened 8 years ago Closed 8 years ago

Make crashes of GeckoBackgroundThread visible

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox50 fixed)

RESOLVED FIXED
Firefox 50
Tracking Status
firefox50 --- fixed

People

(Reporter: sebastian, Assigned: sebastian)

References

Details

Attachments

(1 file)

What's scary about bug 1279332 is that we don't notice that: The background thread throws an exception and stops running.

Let's catch the exception and re-throw it on the main thread, causing a crash. This will make such problems visible and we are able to fix it.
Assignee: nobody → s.kaspari
Status: NEW → ASSIGNED
After trying to add reporting of uncaught exceptions to the background thread I realized that this is already happening by default.

However we are suppressing the exception/crash here:
https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java#137

We are currently in state RUNNING(6). The ranking just recently changed here:
https://hg.mozilla.org/mozilla-central/rev/e4c63fb9f8b0

EXITING was 8 before, now it's 3. So with current state RUNNING isStateAtLeast(EXITING) is now true (6 >= 3) and was false before (6 >= 8).

@jchen: From bug 1268125 I can't see why we changed the rank of EXITING. Was this intentional? Do we need to change the logic in GeckoAppShell now?
Flags: needinfo?(nchen)
See Also: → 1268125
I think I've seen something similar for the main/UI thread as well:
While working on the Recently Closed folder, I'd encountered a bug where the whole UI would simply hang.

It turned out that when about:home is opened from the tabs tray, things are initialised in a different order, so I was calling a function on an object while it was still null. Instead of giving an appropriate exception, it turned out that - just as in your case - the UI thread simply silently died afterwards, which of course left the whole UI hanging.
Yep the EXITING change was by design, but GeckoAppShell needs to now check

> GeckoThread.isState(GeckoThread.State.EXITING) ||
>     GeckoThread.isState(GeckoThread.State.EXITED)
Flags: needinfo?(nchen)
Comment on attachment 8762671 [details]
Bug 1279488 - GeckoAppShell.uncaughtException(): Update state check.

https://reviewboard.mozilla.org/r/59212/#review56372

r+ with change.

::: mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java:138
(Diff revision 1)
>          }
>  
>          @Override
>          public void uncaughtException(final Thread thread, final Throwable exc) {
> -            if (GeckoThread.isStateAtLeast(GeckoThread.State.EXITING)) {
> +            if (GeckoThread.isState(GeckoThread.State.EXITING) ||
> +                    GeckoThread.isState(GeckoThread.State.EXITING)) {

Staet.EXITED for the second line :)
Attachment #8762671 - Flags: review?(nchen) → review+
https://reviewboard.mozilla.org/r/59212/#review56562

::: mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java:138
(Diff revision 1)
>          }
>  
>          @Override
>          public void uncaughtException(final Thread thread, final Throwable exc) {
> -            if (GeckoThread.isStateAtLeast(GeckoThread.State.EXITING)) {
> +            if (GeckoThread.isState(GeckoThread.State.EXITING) ||
> +                    GeckoThread.isState(GeckoThread.State.EXITING)) {

Oops.
Comment on attachment 8762671 [details]
Bug 1279488 - GeckoAppShell.uncaughtException(): Update state check.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/59212/diff/1-2/
Pushed by s.kaspari@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0df6c5c1260b
GeckoAppShell.uncaughtException(): Update state check. r=jchen
https://hg.mozilla.org/mozilla-central/rev/0df6c5c1260b
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: