firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Firebase crashlytics not able to read crash reports

Open moetouban opened this issue 6 years ago • 41 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category using one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.6.3_
  • Firebase Component: crashlytics___ (Database, Firestore, Storage, Functions, etc)
  • Component version: 17.0.0_

[REQUIRED] Step 3: Describe the problem

Just integrated firebase crashlytics into our app. Other services, like analytics and remote config are working fine. Invoking a crash from the app doesn't show on the firebase console. After investigation I found that there is an issue with writing/reading the log files.

Steps to reproduce:

--------- beginning of main
--------- beginning of system
--------- beginning of crash
05-13 14:24:54.353 26520 26520 D FirebaseCrashlytics: Crashlytics is handling uncaught exception "java.lang.RuntimeException: Test Crash" from thread main
05-13 14:24:54.358 26520 26716 D FirebaseCrashlytics: Logging Crashlytics event to Firebase
05-13 14:24:54.364 26520 26716 D FirebaseCrashlytics: Background thread awaiting app exception callback from FA...
05-13 14:24:54.403 26520 26571 D FirebaseCrashlytics: No log data to include with this event.
05-13 14:24:54.431 26520 26718 D FirebaseCrashlytics: AnalyticsConnectorReceiver received message: 3 Bundle[{params=Bundle[{_o=clx, _r=1, _et=158031, _sc=LoginActivity, _si=-1937657330150563214, timestamp=1589397894353, fatal=1}], name=_ae, timestampInMillis=1589397894358}]
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics: Could not persist event for session 5EBC48E70257000167989D7960C5AFF3
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics: java.io.FileNotFoundException: /data/user/0/com.freshbooks.andromeda.debug/files/.com.google.firebase.crashlytics/report-persistence/sessions/5EBC48E70257000167989D7960C5AFF3/event0000000000_: open failed: ENOENT (No such file or directory)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.IoBridge.open(IoBridge.java:496)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at java.io.FileOutputStream.<init>(FileOutputStream.java:235)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.writeTextFile(com.google.firebase:firebase-crashlytics@@17.0.0:461)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.persistEvent(com.google.firebase:firebase-crashlytics@@17.0.0:152)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(com.google.firebase:firebase-crashlytics@@17.0.0:249)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(com.google.firebase:firebase-crashlytics@@17.0.0:121)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:400)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:393)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(com.google.firebase:firebase-crashlytics@@17.0.0:106)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(com.google.firebase:firebase-crashlytics@@17.0.0:60)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(com.google.firebase:firebase-crashlytics@@17.0.0:27)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at java.lang.Thread.run(Thread.java:919)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.Linux.open(Native Method)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   at libcore.io.IoBridge.open(IoBridge.java:482)
05-13 14:24:54.431 26520 26571 D FirebaseCrashlytics:   ... 15 more
05-13 14:24:54.431 26520 26716 D FirebaseCrashlytics: App exception callback received from FA listener.
05-13 14:24:54.432 26520 26571 E FirebaseCrashlytics: Tried to write a fatal exception while no session was open.
05-13 14:24:54.438 26520 26571 D FirebaseCrashlytics: No open sessions to be closed.
05-13 14:24:54.439 26520 26571 D FirebaseCrashlytics: Opening a new session with ID 5EBC498601B6-0002-6798-9D7960C5AFF3
05-13 14:24:54.455 26520 26571 D FirebaseCrashlytics: Send via DataTransport disabled. Removing DataTransport reports.
05-13 14:24:54.457 26520 26520 D FirebaseCrashlytics: Crashlytics completed exception processing. Invoking default exception handler.

Relevant Code:

Just integrate the SDK

moetouban avatar May 14 '20 01:05 moetouban

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar May 14 '20 01:05 google-oss-bot

Any updates on this issue @TKBurner ? it currently prevents us from integrating firebase crashlytics into our app. Is there a workaround for that matter? maybe using an older version for the time being?

moetouban avatar May 27 '20 02:05 moetouban

I'm also seeing this stack trace. Android 10, same Firebase version.

2020-05-27 22:20:13.694 27988-28075/com.wrc.wordstorm.android D/FirebaseCrashlytics: Could not read user ID file in 5ECED97B03D000016D54ED6486A946DA
    java.io.FileNotFoundException: /data/user/0/com.wrc.wordstorm.android/files/.com.google.firebase.crashlytics/report-persistence/sessions/5ECED97B03D000016D54ED6486A946DA/user: open failed: ENOENT (No such file or directory)
        at libcore.io.IoBridge.open(IoBridge.java:496)
        at java.io.FileInputStream.<init>(FileInputStream.java:159)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.readTextFile(com.google.firebase:firebase-crashlytics@@17.0.0:470)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.synthesizeReport(com.google.firebase:firebase-crashlytics@@17.0.0:309)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.finalizeReports(com.google.firebase:firebase-crashlytics@@17.0.0:197)
        at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.finalizeSessions(com.google.firebase:firebase-crashlytics@@17.0.0:159)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:867)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:827)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:407)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:393)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(com.google.firebase:firebase-crashlytics@@17.0.0:106)
        at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(com.google.firebase:firebase-crashlytics@@17.0.0:60)
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(com.google.firebase:firebase-crashlytics@@17.0.0:27)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
        at libcore.io.Linux.open(Native Method)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
        at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
        at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255)
        at libcore.io.IoBridge.open(IoBridge.java:482)
        at java.io.FileInputStream.<init>(FileInputStream.java:159) 
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.readTextFile(com.google.firebase:firebase-crashlytics@@17.0.0:470) 
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.synthesizeReport(com.google.firebase:firebase-crashlytics@@17.0.0:309) 
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.finalizeReports(com.google.firebase:firebase-crashlytics@@17.0.0:197) 
        at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.finalizeSessions(com.google.firebase:firebase-crashlytics@@17.0.0:159) 
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:867) 
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:827) 
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:407) 
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:393) 
        at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(com.google.firebase:firebase-crashlytics@@17.0.0:106) 
        at com.google.android.gms.tasks.zzf.run(Unknown Source:2) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(com.google.firebase:firebase-crashlytics@@17.0.0:60) 
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(com.google.firebase:firebase-crashlytics@@17.0.0:27) 
        at java.lang.Thread.run(Thread.java:919) 

WillCalderwood avatar May 27 '20 21:05 WillCalderwood

Thanks. Are you doing any cleanup on app shutdown or relaunch that would delete this file? Are you seeing this on all devices?

TKBurner avatar May 28 '20 15:05 TKBurner

I'm doing no cleanup of files on startup or shutdown. I currently only have 1 test device, but the reason I found the problem is because 3 users have emailed me saying they're experiencing crashes and none of those crashes have been reported. I have had 1 crash reported, so it's obviously working on some devices, but the ratio of crash emails to crash reports would suggest it's not working on more devices that it is working on.

WillCalderwood avatar May 28 '20 17:05 WillCalderwood

Hey folks - just wanted to chime in here and thank everyone for reporting this! Definitely seems strange. For those of you seeing it, are you able to reproduce it 100% of the time or does it seem to be transient?

mrwillis21 avatar May 28 '20 18:05 mrwillis21

It's 100% of the time on my device. Pixel 3a. Unfortunately all my still working old devices have been adopted by the kids with Family Link accounts that Google wont let me run debug mode on, so I can't test on another device without inducing a meltdown.

Would having an APK help you? Happy to link to one with a forced crash in.

WillCalderwood avatar May 28 '20 18:05 WillCalderwood

@WillCalderwood appreciate the offer! I think I have a sense of what might be happening here, so any corroborating evidence would be helpful. If you could - please enable debug logging on your device by running adb shell setprop log.tag.FirebaseCrashlytics VERBOSE, start up your app, crash it, then grab the logs from logcat. If you're comfortable posting them here, that's fine, or feel free to send them (and the APK if you'd like) through https://firebase.google.com/support/troubleshooter/contact. Just reference this Github issue, and let them know I requested the information. :)

Thanks again!

mrwillis21 avatar May 28 '20 18:05 mrwillis21

@mrwillis21 Sorry for the slow reply. I seem to have a test crash that's appeared on Crashlytics now. I've been trying to work out what's changed/what's going on. That said, I'm still getting the error. Here are the logcat files.

One file with everything and one with just Firebase. Do you still want the APK after looking at this? If so, I'll send it over shortly.

WillCalderwood avatar May 28 '20 20:05 WillCalderwood

@WillCalderwood I'll take a look at those files - thanks! And if you're open to sending across the APK, I'm happy to try it out locally.

mrwillis21 avatar May 28 '20 20:05 mrwillis21

@mrwillis21 I've sent a link to an apk via the contact form. Start it up and click "Play" to trigger a crash.

WillCalderwood avatar May 28 '20 20:05 WillCalderwood

Hi guys, I'm also having the same issue. Will highly appreciate a solution for that, thanks in advance.

tshegomasilo21 avatar May 28 '20 21:05 tshegomasilo21

I was having a similar issue, I think what was happening for me was we were deleting all files in our app's file dir on logout which includes the firebase session file so next time there was a crash it was still looking for that file but couldn't find it.

05-29 08:54:22.127 20607 20668 D FirebaseCrashlytics: Could not persist event for session 5ED12F87026C0001507F24553B7DC95 05-29 08:54:22.127 20607 20668 D FirebaseCrashlytics: java.io.FileNotFoundException: /data/user/0/<app name>/files/.com.google.firebase.crashlytics/report-persistence/sessions/5ED12F87026C0001507F24553B7DC95/event0000000000_ (No such file or directory)

Is that expected behavior or should it still retain crashes even if the session file is removed?

MaxBuster avatar May 29 '20 15:05 MaxBuster

I've managed to get another device - still Android 10 though. I get the same error.

WillCalderwood avatar Jun 01 '20 09:06 WillCalderwood

I have similar issue. It's persistent 100% of the cases (Nokia 5, Android 9, AS 4.0), I'm crashing app on startup, so don't delete any files. From logs I can see that Firebase Crashlytics is initializing OK:

I/FirebaseCrashlytics: Initializing Crashlytics 17.0.0
D/FirebaseCrashlytics: Installer package name is: null
D/FirebaseCrashlytics: Found previous crash marker.
D/FirebaseCrashlytics: Exception handling initialization successful
D/FirebaseCrashlytics: Found matching FID, using Crashlytics IID: b12542144c594c1aa62739d4a5d3600d
I/FirebaseInitProvider: FirebaseApp initialization successful

but then right after crash:

D/FirebaseCrashlytics: Crashlytics is handling uncaught exception "java.lang.RuntimeException: Unable to create application io.piesystems.pie.PieApp: java.lang.RuntimeException: Test Crash" from thread main
D/FirebaseCrashlytics: Skipping logging Crashlytics event to Firebase, no Firebase Analytics
D/FirebaseCrashlytics: No log data to include with this event.
D/FirebaseCrashlytics: No log data to include with this event.
D/FirebaseCrashlytics: Closing open sessions.
D/FirebaseCrashlytics: Closing session: 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Collecting session parts for ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Session 5ED7AF4A0304-0001-7C23-96579946F755 has fatal exception: true
D/FirebaseCrashlytics: Session 5ED7AF4A0304-0001-7C23-96579946F755 has non-fatal exceptions: false
D/FirebaseCrashlytics: Collecting SessionStart data for session ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Collecting SessionUser data for session ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Collecting SessionApp data for session ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Collecting SessionOS data for session ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Collecting SessionDevice data for session ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Removing session part files for ID 5ED7AF4A0304-0001-7C23-96579946F755
D/FirebaseCrashlytics: Could not read user ID file in 5ED7AF4A030400017C2396579946F755
java.io.FileNotFoundException: /data/user/0/io.piesystems.pie.qa/files/.com.google.firebase.crashlytics/report-persistence/sessions/5ED7AF4A030400017C2396579946F755/user (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:231)
        at java.io.FileInputStream.<init>(FileInputStream.java:165)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.readTextFile(com.google.firebase:firebase-crashlytics@@17.0.0:470)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.synthesizeReport(com.google.firebase:firebase-crashlytics@@17.0.0:309)
        at com.google.firebase.crashlytics.internal.persistence.CrashlyticsReportPersistence.finalizeReports(com.google.firebase:firebase-crashlytics@@17.0.0:197)
        at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.finalizeSessions(com.google.firebase:firebase-crashlytics@@17.0.0:159)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:867)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(com.google.firebase:firebase-crashlytics@@17.0.0:827)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:407)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$6.call(com.google.firebase:firebase-crashlytics@@17.0.0:393)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(com.google.firebase:firebase-crashlytics@@17.0.0:106)
        at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(com.google.firebase:firebase-crashlytics@@17.0.0:60)
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(com.google.firebase:firebase-crashlytics@@17.0.0:27)
        at java.lang.Thread.run(Thread.java:764)
2020-06-03 16:10:19.688 31779-31829/io.piesystems.pie.qa D/FirebaseCrashlytics: Opening a new session with ID 5ED7AF4B02AE-0002-7C23-96579946F755
2020-06-03 16:10:22.984 31779-31779/io.piesystems.pie.qa D/FirebaseCrashlytics: Crashlytics completed exception processing. Invoking default exception handler.
2020-06-03 16:10:48.652 31779-31821/io.piesystems.pie.qa W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
2020-06-03 16:11:48.660 31779-31821/io.piesystems.pie.qa W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval
2020-06-03 16:13:18.670 31779-31821/io.piesystems.pie.qa W/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE. Will retry token retrieval

mirokolodii avatar Jun 03 '20 14:06 mirokolodii

For now I've rolled back to Fabric Crashlytics and it's reporting fine to Firebase console.

mirokolodii avatar Jun 03 '20 14:06 mirokolodii

@mirokolodii Thanks for the report - is this in your full app or in a test project?

mrwillis21 avatar Jun 03 '20 15:06 mrwillis21

@mrwillis21 it's a production app, which I've tried to migrate from Fabric Crashlytics to Firebase.

mirokolodii avatar Jun 03 '20 15:06 mirokolodii

Hey everyone, it looks like there are a few different issues here, so I wanted to comment on the one that appears most commonly:

If you're seeing a log entry for FileNotFoundException that ends in /user -- that is benign. It's an optional file, and if it's missing, you should still get a crash report. Further down in your logs (just below this) you should see logs saying Sending report to: [endpoint] and Result was: 202. @WillCalderwood, this does appear in your logs, right at the bottom, so I believe your reports are being uploaded successfully. @mirokolodii this appears to be what you're experiencing as well.

We'll patch this up for the next release so that optional file does not end up polluting the logs this way.

For the other files that are missing (including the one from the original post in this thread), that still strikes me as strange, and I'm going to continue investigating.

mrwillis21 avatar Jun 03 '20 18:06 mrwillis21

@moetouban Can I get a little more information about your app, and the context in which you're seeing this error? Is it a test crash? On startup? As @TKBurner had mentioned, are you clearing any app files at any point in your app lifecycle?

mrwillis21 avatar Jun 03 '20 18:06 mrwillis21