Closed Bug 1469086 Opened 4 years ago Closed 4 years ago

Crash in Context.startForegroundService() did not then call Service.startForeground() at$H.handleMessage(


(Firefox for Android Graveyard :: General, defect)

Not set


(firefox-esr60 unaffected, firefox60 unaffected, firefox61 unaffected, firefox62+ fixed)

Firefox 62
Tracking Status
firefox-esr60 --- unaffected
firefox60 --- unaffected
firefox61 --- unaffected
firefox62 + fixed


(Reporter: calixte, Unassigned)


(Blocks 1 open bug)


(Keywords: crash, regression)

Crash Data

This bug was filed from the Socorro interface and is
report bp-4d9fba9e-6e5a-404c-a67a-5fb910180615.
============================================================= Context.startForegroundService() did not then call Service.startForeground()
	at android.os.Handler.dispatchMessage(
	at android.os.Looper.loop(
	at java.lang.reflect.Method.invoke(Native Method)


There are 14 crashes in nightly 62 starting with buildid 20180612100032. In analyzing the backtrace, the regression may have been introduced by patch [1] to fix bug 1465102.

Flags: needinfo?(vlad.baicu)
This seems to be the same situation as the one I mentioned in bug 1384866, originating from google's tracker I think we should revert the patch for now, ni'ing Jan and Mike for their opinions as well
Flags: needinfo?(vlad.baicu)
Flags: needinfo?(michael.l.comella)
Flags: needinfo?(jh+bugzilla)
The notification code is hard to follow: are we certain we've had the opportunity to call `startForeground` before we call `stopService`?

One red flag in particular is that `onNotificationClose`, which calls stopService, is `synchronized` implying this class is intended to be accessed from multiple threads. It could be that we call startForegroundService and another thread quickly calls onNotificationClose before the new service can start (which will get queued to run on the UI thread when the intent is launched).

It doesn't help that this code is underdocumented (why does it need to be thread-safe? What is the difference between a NotificationClient and a NotificationHelper?).

But otherwise, I'd have to dig into the code further to understand what it actually does to provide a better response.
Flags: needinfo?(michael.l.comella)
Maybe small downloads (especially on fast connections) manage to complete fast enough that we want to cancel the ongoing "Downloading..." notification again (which entails stopping the service) before the NotificationService had a chance to execute onStartCommand?
Flags: needinfo?(jh+bugzilla)
Tracking for 62 since this is a top crash in 62 nightly.
bug 1465102 was backed out
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
See Also: → 1477041
Product: Firefox for Android → Firefox for Android Graveyard

I still got the error

I got the issue while fixing on my Android. This guide ([] was helpful.

I got the issue while fixing on my Android. This guide [] ( was helpful.

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