Closed Bug 1483329 Opened 6 years ago Closed 6 years ago

Add crash handling API

Categories

(GeckoView :: General, enhancement, P1)

63 Branch
Unspecified
Android
enhancement

Tracking

(geckoview62 wontfix, firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 wontfix, firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
geckoview62 --- wontfix
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- wontfix
firefox64 --- fixed

People

(Reporter: snorp, Assigned: snorp)

References

Details

(Whiteboard: [geckoview:fxr:p1][geckoview:klar:p2])

Attachments

(8 files)

46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
droeh
: review+
esawin
: review+
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
46 bytes, text/x-phabricator-request
jchen
: review+
Details | Review
Focus and FxR want to report crashes themselves, so they can prompt the user or report to multiple places. The current toggle to enable GeckoView to send the crash report itself is not adequate.
Whiteboard: [geckoview:fxr:p1][geckoview:klar:p1]
Assignee: nobody → snorp
Alright, the plan here is as follows:

Remove the current crash-related stuff from GeckoRuntime.

Add a new method to GeckoRuntimeSettings that allows you to set a Class for a Service which will be started in response to crashes. We'll document the Intent details such as the action and all of the extras it will receive. In the main process (app process) it will only catch native crashes. The app is on its own for dealing with unhandled exceptions. For child processes we'll try to report any type of crash. In this case the app will receive a flag indicating that it was not a fatal crash. The onCrash() method in ContentDelegate remains as a way for the app to recover from such a crash.

The crash handling service is started as a foreground service, since background services are not allowed on Oreo+. This means the Service has to call startForeground()[1] (which requires a Notification) or it will be killed pretty quickly[2]. Experimentation has revealed that you can start a new activity (in a new process) or schedule work with JobScheduler without having to all startForeground().

The future ideal situation is that Gecko's main process will be separate from the app process. Once that is complete, none of the Gecko crash handling will conflict with the app at all. We aren't there yet, but hopefully this plan at least allows the app some flexibility in the reporting.

[1] https://developer.android.com/reference/android/app/Service.html#startForeground(int,%20android.app.Notification)
[2] https://developer.android.com/about/versions/oreo/background#services
Attachment #9003880 - Flags: feedback?(s.kaspari)
Comment on attachment 9003880 [details]
Bug 1483329 - Add crash handling API to GeckoRuntime r=jchen,esawin

Dylan Roeh (:droeh) has approved the revision.
Attachment #9003880 - Flags: review+
Comment on attachment 9003879 [details]
Bug 1483329 - Remove job id methods from GeckoRuntimeSettings r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003879 - Flags: review+
Comment on attachment 9003878 [details]
Bug 1483329 - Remove existing crash-related methods in GeckoRuntimeSettings r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003878 - Flags: review+
Comment on attachment 9003880 [details]
Bug 1483329 - Add crash handling API to GeckoRuntime r=jchen,esawin

Eugen Sawin [:esawin] on leave has approved the revision.
Attachment #9003880 - Flags: review+
Comment on attachment 9003883 [details]
Bug 1483329 - Report content process crashes via GeckoRuntime r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003883 - Flags: review+
Comment on attachment 9003884 [details]
Bug 1483329 - Add tests for GeckoRuntime crash handling API r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003884 - Flags: review+
status-geckoview62=wontfix because we don't need to uplift the GV crash reporter to GECKOVIEW_62_RELBRANCH. Focus will disable GV crash reporting in https://github.com/mozilla-mobile/focus-android/issues/3217. Even without GV crash reporting, we can still monitor GV's crash volume because Focus submits Sentry crash reports for GeckoSession.onCrash() callbacks like https://github.com/mozilla-mobile/focus-android/issues/2900.
[geckoview:klar:p2] because the GV crash reporter is not a Focus+GV release blocker. As noted above in comment 16, Focus can disable GV's Breakpad crash reporting and rely on Sentry crash reporting to avoid PII issues.
Whiteboard: [geckoview:fxr:p1][geckoview:klar:p1] → [geckoview:fxr:p1][geckoview:klar:p2]
Version: Firefox 59 → Firefox 63
Comment on attachment 9003885 [details]
Bug 1483329 - Hook up GeckoSessionTestRule and TestRunnerActivity to crash reporting r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003885 - Flags: review+
Comment on attachment 9003882 [details]
Bug 1483329 - Hook up geckoview_example to new crash reporting API r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003882 - Flags: review+
Comment on attachment 9003881 [details]
Bug 1483329 - Hook Fennec up to new crash handling API r=jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003881 - Flags: review+
Comment on attachment 9003880 [details]
Bug 1483329 - Add crash handling API to GeckoRuntime r=jchen,esawin

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9003880 - Flags: review+
Pushed by jwillcox@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0b4e37c0e3a4
Remove existing crash-related methods in GeckoRuntimeSettings r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/03ec9a21d6b7
Remove job id methods from GeckoRuntimeSettings r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/730ce6aee5d2
Add crash handling API to GeckoRuntime r=jchen,esawin
https://hg.mozilla.org/integration/mozilla-inbound/rev/cd805c5472d5
Hook Fennec up to new crash handling API r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/a417022fbfd4
Hook up geckoview_example to new crash reporting API r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/e8e0d1e76a4f
Report content process crashes via GeckoRuntime r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/2e53cff1c083
Add tests for GeckoRuntime crash handling API r=jchen
https://hg.mozilla.org/integration/mozilla-inbound/rev/47ee3d56910d
Hook up GeckoSessionTestRule and TestRunnerActivity to crash reporting r=jchen
status-firefox63=wontfix because James says this is API is too big to uplift.
Attachment #9003880 - Flags: feedback?(s.kaspari)
Product: Firefox for Android → GeckoView
Version: Firefox 63 → 63 Branch
Target Milestone: Firefox 64 → mozilla64
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: