question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConcurrentModificationException in MetaDataStore.keysDataToJson for Crashlytics

See original GitHub issue

Environment

  • Android Studio version: Arctic Fox | 2020.3.1 Beta 5
  • Firebase Component: Crashlytics
  • Component version: 18.1.0

Problem

Normal usage of Crashlytics v18.1.0 leads to error in logcat:

E/FirebaseCrashlytics: Error serializing key/value metadata.
    java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1441)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1475)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1473)
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1.next(Collections.java:1708)
        at java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$1.next(Collections.java:1701)
        at org.json.JSONObject.<init>(JSONObject.java:138)
        at com.google.firebase.crashlytics.internal.common.MetaDataStore.keysDataToJson(MetaDataStore.java:157)
        at com.google.firebase.crashlytics.internal.common.MetaDataStore.writeKeyData(MetaDataStore.java:91)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$8.call(CrashlyticsController.java:484)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$8.call(CrashlyticsController.java:480)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:105)
        at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@17.2.1:3)
        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(ExecutorUtils.java:64)
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
        at java.lang.Thread.run(Thread.java:920)

Steps to reproduce:

Issue happens on application start. FirebaseCrashlytics#setUserId and FirebaseCrashlytics#log methods used from application code.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mrichardscommented, Jul 22, 2021

Hi folks, I’m able to reproduce the bug internally and we’ll have a fix in an upcoming release. Note this does NOT cause the app to crash, but it could result in inconsistent / unexpected data when using Crashlytics’ custom key/data feature. (If you are seeing app crashes due to this, please report them here!)

While it appears that there’s a long-time bug that could result in a ConcurrentModificationException under certain circumstance (both for Unity and non-Unity apps), there was a change in the Firebase Unity 7.2.0 release that makes it considerably more likely to occur for Unity apps, especially near app launch.

(@ivangonzalez88 your repro example won’t compile against the latest release of the SDK because of recent, soon-to-be-shipped source changes. But the general principal to reproduce the bug is the same.)

1reaction
mrichardscommented, Aug 17, 2021

Hi folks, this issue is fixed as of v18.2.1!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found