Skip to content

IllegalMonitorStateException in FirebaseInstallations #3322

Open
@your-mirror

Description

@your-mirror

[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: Arctic Fox 2020.3.1 Patch 4
  • Firebase Components & components version:
    com.google.firebase:firebase-crashlytics-gradle 2.7.1
    com.google.firebase:firebase-bom 25.9.0
    com.google.firebase:firebase-messaging 20.2.4
    com.google.firebase:firebase-iid 20.2.4
    com.google.firebase:firebase-analytics 17.5.0
    com.google.firebase:firebase-dynamic-links 19.1.0
    com.google.firebase:firebase-crashlytics 18.2.1

[REQUIRED] Step 3: Describe the problem

We have many crashes in Firebase Crashlytics. I saw similar bug

Steps to reproduce:

No steps to reproduce, it crashes randomly

  • it seems to happen only on Android 8 (81%) & 9 (19%) devices
  • 91% of crashes happen on xiaomi phones

Relevant Code:

Exception log:
1.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.LinkedHashMap.get(java.lang.Object)' on a null object reference
       at org.json.JSONObject.opt(JSONObject.java:402)
       at org.json.JSONObject.optString(JSONObject.java:574)
       at com.google.firebase.installations.local.PersistedInstallation.readPersistedInstallationEntryValue(PersistedInstallation.java:93)
       at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:624)
       at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:381)
       at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:377)
       at com.avito.android.component.contact_bar.AdvertDetailsContactBar$$InternalSyntheticLambda$0$492c2372c1aaa97d7fe79dc7ebc678ee9c68c69f880b47fc1b918ad55f542bf4$1.run$bridge(AdvertDetailsContactBar.java:7)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)
Fatal Exception: java.lang.IllegalMonitorStateException: unlock of unowned monitor on object of type 'java.io.ByteArrayOutputStream' on thread 'Thread[350,tid=31814,Runnable,Thread*=0x7a605a3c00,peer=0x17411c70,"firebase-installations-executor-56"]'
       at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:221)
       at com.google.firebase.installations.local.PersistedInstallation.readJSONFromFile(PersistedInstallation.java:125)
       at com.google.firebase.installations.local.PersistedInstallation.readPersistedInstallationEntryValue(PersistedInstallation.java:91)
       at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:624)
       at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:381)
       at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:377)
       at com.avito.android.component.contact_bar.AdvertDetailsContactBar$$InternalSyntheticLambda$0$492c2372c1aaa97d7fe79dc7ebc678ee9c68c69f880b47fc1b918ad55f542bf4$1.run$bridge(AdvertDetailsContactBar.java:7)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:764)
Fatal Exception: java.lang.StringIndexOutOfBoundsException: length=0; regionStart=0; regionLength=514
       at java.lang.StringFactory.newStringFromChars(StringFactory.java:218)
       at java.lang.StringFactory.newStringFromBytes(StringFactory.java:205)
       at java.lang.StringFactory.newStringFromBytes(StringFactory.java:54)
       at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:221)
       at com.google.firebase.installations.local.PersistedInstallation.readJSONFromFile(PersistedInstallation.java:125)
       at com.google.firebase.installations.local.PersistedInstallation.readPersistedInstallationEntryValue(PersistedInstallation.java:91)
       at com.google.firebase.installations.FirebaseInstallations.getMultiProcessSafePrefs(FirebaseInstallations.java:624)
       at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary(FirebaseInstallations.java:381)
       at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2(FirebaseInstallations.java:377)
       at com.avito.android.component.contact_bar.AdvertDetailsContactBar$$InternalSyntheticLambda$0$492c2372c1aaa97d7fe79dc7ebc678ee9c68c69f880b47fc1b918ad55f542bf4$1.run$bridge(AdvertDetailsContactBar.java:7)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

Activity

google-oss-bot

google-oss-bot commented on Jan 17, 2022

@google-oss-bot
Contributor

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

argzdev

argzdev commented on Jan 17, 2022

@argzdev
Contributor

Hi @your-mirror, thanks for reporting. We'll investigate this and see what we can find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @your-mirror@google-oss-bot@patrickhoh@argzdev

      Issue actions

        IllegalMonitorStateException in FirebaseInstallations · Issue #3322 · firebase/firebase-android-sdk