Skip to content

LogFileManager.getLogString leaking Closeable during SessionReportingCoordinator.addLogsCustomKeysAndEventKeysToEvent #7341

@Nek-12

Description

@Nek-12

[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 use 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: N/A
  • Firebase Component: Crashlytics
  • Component version: 3.0.6

[REQUIRED] Step 3: Describe the problem

StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                     	at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:2005)
                     	at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:336)
                     	at java.io.RandomAccessFile.finalize(RandomAccessFile.java:1256)
                     	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:370)
                     	at java.lang.Daemons$FinalizerDaemon.processReference(Daemons.java:350)
                     	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:322)
                     	at java.lang.Daemons$Daemon.run(Daemons.java:131)
                     	at java.lang.Thread.run(Thread.java:1012)
                     Caused by: java.lang.Throwable: Explicit termination method 'close' not called
                     	at dalvik.system.CloseGuard.openWithCallSite(CloseGuard.java:288)
                     	at dalvik.system.CloseGuard.open(CloseGuard.java:257)
                     	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:310)
                     	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:237)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFile.open(QueueFile.java:221)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFile.<init>(QueueFile.java:119)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFileLogStore.openLogFile(QueueFileLogStore.java:128)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFileLogStore.getLogBytes(QueueFileLogStore.java:79)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFileLogStore.getLogAsBytes(QueueFileLogStore.java:58)
                     	at com.google.firebase.crashlytics.internal.metadata.QueueFileLogStore.getLogAsString(QueueFileLogStore.java:69)
                     	at com.google.firebase.crashlytics.internal.metadata.LogFileManager.getLogString(LogFileManager.java:73)
                     	at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.addLogsCustomKeysAndEventKeysToEvent(SessionReportingCoordinator.java:274)
                     	at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.addLogsAndCustomKeysToEvent(SessionReportingCoordinator.java:306)
                     	at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistRelevantAppExitInfoEvent(SessionReportingCoordinator.java:160)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsController.writeApplicationExitInfoEventIfRelevant(CrashlyticsController.java:929)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsController.doCloseSessions(CrashlyticsController.java:593)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsController.finalizeSessions(CrashlyticsController.java:521)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.doBackgroundInitialization(CrashlyticsCore.java:250)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.lambda$doBackgroundInitializationAsync$0$com-google-firebase-crashlytics-internal-common-CrashlyticsCore(CrashlyticsCore.java:227)
                     	at com.google.firebase.crashlytics.internal.common.CrashlyticsCore$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                     	at com.google.firebase.crashlytics.internal.concurrency.CrashlyticsWorker.lambda$submit$1(CrashlyticsWorker.java:96)
                     	at com.google.firebase.crashlytics.internal.concurrency.CrashlyticsWorker$$ExternalSyntheticLambda0.then(D8$$SyntheticClass:0)
                     	at com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.1.0:1)
                     	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                     	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                     	at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
                     	at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                     	at java.lang.Thread.run(Thread.java:1012) 
System.err           StrictMode VmPolicy violation with POLICY_DEATH; shutting down.

Steps to reproduce:

This seems to happen EITHER: on app startup after ANRs, leading to repeated anrs or crashes, or after setCustomKeys is called.

Relevant Code:

N/A - no user code in the stacktrace.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions