ConcurrentModificationException in MetaDataStore.keysDataToJson for Crashlytics
See original GitHub issueEnvironment
- 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:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.)
Hi folks, this issue is fixed as of v18.2.1!