android-components icon indicating copy to clipboard operation
android-components copied to clipboard

Amend crash pings to distinguish between FOREGROUND_CHILD and BACKGROUND_CHILD

Open agi opened this issue 4 years ago • 6 comments

With the implementation of the GPU process we now have two types of non-fatal crash: FOREGROUND_CHILD, i.e. something that blocks a user from interacting with a tab, e.g. a content process crash, and BACKGROUND_CHILD, i.e. a crash that is not user visible but we would still like to report.

The crash ping currently doesn't distinguish between these two, it would be nice to amend it so that it does. This will be helpful in estimating how many crashes we lose because the user doesn't report them.

@Dexterp37 can Glean telemetry be changed relatively easily? is there something special that we need to do for that?

┆Issue is synchronized with this Jira Task

agi avatar Mar 16 '22 16:03 agi

cc @jamienicol @csadilek

agi avatar Mar 16 '22 16:03 agi

@Dexterp37 can Glean telemetry be changed relatively easily? is there something special that we need to do for that?

Yes, Glean telemetry can be changed easily (even without the relatively part :-) ).

Note that Glean does not send the crash ping natively, it is instead a custom ping sent by Android-Components's lib-crash (read here).

Specifically, here's the code that does the magic: https://github.com/mozilla-mobile/android-components/blob/main/components/lib/crash/src/main/java/mozilla/components/lib/crash/service/GleanCrashReporterService.kt

I believe the "hard part" would be to make the CrashReporterService detect these crashes you're interested in. I defer it to @csadilek for that part.

Dexterp37 avatar Mar 16 '22 16:03 Dexterp37

The good news is the hard part should have been taken care of by #11872 :smile:

Being able to tell how many crashes go unreported would definitely be good to help evaluate whether the system notification is good enough (as @csadilek noted in #11872)

I can have a go at implementing this. Do we basically just want to replace FATAL_NATIVE_CODE_CRASH_KEY and NONFATAL_NATIVE_CODE_CRASH_KEY, with MAIN_PROCESS_NATIVE_CODE_CRASH_KEY, FOREGROUND_CHILD_PROCESS_NATIVE_CODE_CRASH_KEY, and BACKGROUND_CHILD_PROCESS_NATIVE_CODE_CRASH_KEY?

jamienicol avatar Mar 16 '22 17:03 jamienicol

The good news is the hard part should have been taken care of by #11872 😄

Then this is your lucky day!

I can have a go at implementing this. Do we basically just want to replace FATAL_NATIVE_CODE_CRASH_KEY and NONFATAL_NATIVE_CODE_CRASH_KEY, with MAIN_PROCESS_NATIVE_CODE_CRASH_KEY, FOREGROUND_CHILD_PROCESS_NATIVE_CODE_CRASH_KEY, and BACKGROUND_CHILD_PROCESS_NATIVE_CODE_CRASH_KEY?

If this is what you need to do (from a "crash system" POV), then from the data collection POV you need to do the following:

  • Update the description and add the relevant keys to the metrics definition.
    • Do not remove or rename deprecated keys for now, but rather just add the new things: pending data might still be on the disk from previous versions, so we to allow for some grace period before removing deprecated entries.
  • Add the text for the new labes here
  • Then update the parseCrashFile and recordCrash functions.

I want to stress that most of the above is not really Glean/data collection (except for the metrics definition), but rather boilerplate facilities required to deal with crashes :-) Whenever a crash is reported, an entry is saved to a file (with the label to be reported). Once we start properly and have a telemetry system working, the file is read and the ping is finally assembled by Glean and submitted.

Dexterp37 avatar Mar 17 '22 08:03 Dexterp37

/cc @rocketsroger

csadilek avatar Mar 17 '22 21:03 csadilek

Fixed by https://github.com/mozilla-mobile/android-components/pull/11908.

csadilek avatar Apr 13 '22 19:04 csadilek