Mr Mike
Mr Mike

Reputation: 939

Firebase cause Auto-Restart Crash Loop

Please help with this issue

Issue Summary

We identified a critical crash pattern in Firebase Crashlytics reports: a small subset of users experienced an unusually high repeated crash rate. All crashes occur during application creation.

enter image description here

Those crashes happen because of device-specific issues (incompatible Google Play Service or corruption), which are impossible to fix. We would like to resolve the relaunching loop.

Observations

Reproduction Steps

To investigate the issue, we:

  1. Create a demo app and include Firebase Crashlytics & Firebase Analytics
  2. Simulated a crash during app launch
  3. Observed the following pattern:
    • App crash during launch
    • Automatic relaunch
    • Immediate subsequent crash
    • Pattern repeated indefinitely
    • Most of the time, I could see the app crash and relaunch three times in a round until the OS "[Your app] Keeps stopping" dialog appeared. There are cases it keeps crashing & auto relaunching 20+ times continually (the "[Your app] Keeps stopping" is not showed)

Root Cause

The investigation revealed that:

While the app crashes during app launch, it is scheduled to re-launch the JobInfoSchedulerService after a period, and Firebase used it. (Application launch -> crash -> schedule JobInfoSchedulerService -> Application launch)

ActivityManager     Scheduling restart of crashed service com.example.background/com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService in 1000ms for connection 

I understand that JobInfoSchedulerService is a JobService, which is expected to behave as a JobService. If a JobService hasn't completed its work (returns false from onStopJob()), the system will automatically reschedule the job for later.

Since crashes happen during Application creation, any scheduled jobs, broadcast receivers, or push notifications might trigger this crash loop.

Do you have any suggestions on how to prevent the re-launching loop?

Upvotes: 1

Views: 22

Answers (0)

Related Questions