Closed Bug 1509342 Opened 4 years ago Closed 4 years ago

Crash in java.lang.IllegalStateException: at android.app.ContextImpl.startServiceCommon(ContextImpl.java)

Categories

(Firefox for Android Graveyard :: General, defect, P1)

Firefox 65
Unspecified
Android
defect

Tracking

(firefox-esr60 unaffected, firefox63 unaffected, firefox64 unaffected, firefox65 fixed)

RESOLVED FIXED
Firefox 65
Tracking Status
firefox-esr60 --- unaffected
firefox63 --- unaffected
firefox64 --- unaffected
firefox65 --- fixed

People

(Reporter: calixte, Assigned: droeh)

References

(Blocks 1 open bug)

Details

(Keywords: crash, regression)

Crash Data

Attachments

(1 file)

This bug was filed from the Socorro interface and is
report bp-1e0258ad-63fb-4d18-853b-83eaa0181122.
=============================================================

Java stack trace:

java.lang.IllegalStateException
	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
	at android.app.ContextImpl.startService(ContextImpl.java:1532)
	at android.content.ContextWrapper.startService(ContextWrapper.java:664)
	at org.mozilla.gecko.BrowserApp.onCreate(BrowserApp.java:620)
	at android.app.Activity.performCreate(Activity.java:7136)
	at android.app.Activity.performCreate(Activity.java:7127)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
	at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:4784)
	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4693)
	at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
	at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:55)
	at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:4743)
	at android.app.ActivityThread.access$3200(ActivityThread.java:199)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1818)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:6669)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

There are 3 crashes (from 3 installations) in nightly 65 with buildid 20181121100030. In analyzing the backtrace, the regression may have been introduced by patch [1] to fix bug 1494748.

[1] https://hg.mozilla.org/mozilla-central/rev?node=555521c70c0f
Flags: needinfo?(droeh)
Presumably the background service was start prohibitions on O, i.e. maybe if we get backgrounded again while still starting up. Can I ask to reconsider a solution that doesn't involve a service?
Yeah, this looks like a regression from 1494748; I'll figure something out ASAP.

(In reply to Jan Henning [:JanH] from comment #1)
> Presumably the background service was start prohibitions on O, i.e. maybe if
> we get backgrounded again while still starting up. Can I ask to reconsider a
> solution that doesn't involve a service?

Just to be clear, snorp and I are talking about possible approaches to handle this generally in GeckoView (which should also hopefully fix the issue in Fennec) that won't involve running a service, but that's not likely to land and get uplifted in time to unblock Fennec 64. The service approach is just a temporary fix.
Flags: needinfo?(droeh)
Fair enough, thank you.
I was looking into JobIntentService, but frankly it seems like the simplest thing to do here is just move the startService() call to onResume() to guarantee we're foregrounded when it's called.
Assignee: nobody → droeh
Attachment #9027928 - Flags: review?(snorp)
Attachment #9027928 - Flags: review?(snorp) → review+
Pushed by droeh@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c59f82a36a28
Move startService() call to BrowserApp.onResume() to guarantee we're foregrounded. r=snorp
https://hg.mozilla.org/mozilla-central/rev/c59f82a36a28
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
https://crash-stats.mozilla.com/report/index/ae7658ec-36e0-4be7-ac34-216d20181128 crashed on 20181128100103 which has this fix; I guess that's for a separate bug since it's OnResume rather than OnCreate?
Flags: needinfo?(droeh)
(In reply to Julien Cristau [:jcristau] from comment #7)
> https://crash-stats.mozilla.com/report/index/ae7658ec-36e0-4be7-ac34-
> 216d20181128 crashed on 20181128100103 which has this fix; I guess that's
> for a separate bug since it's OnResume rather than OnCreate?

Reopening this for further investigation; as far as I know we should be guaranteed to be foregrounded in onResume(), so something weird is going on here.
Status: RESOLVED → REOPENED
Flags: needinfo?(droeh)
Resolution: FIXED → ---
I just ran into this directly after unlocking my phone (Pixel 2):

https://crash-stats.mozilla.com/report/index/5b7a2896-a20c-48d3-90e0-ce8220181129
Fixed by the backout in bug 1510587:
https://hg.mozilla.org/mozilla-central/rev/e9a34518f078
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.