firebase-android-sdk
firebase-android-sdk copied to clipboard
ANR: Crashlytics and CloudMessagingReceiver Lock
[REQUIRED] Describe your environment
- Android Studio version: Build #AI-243.24978.46.2431.13208083 Android Studio Meerkat | 2024.3.1 Patch 1
- Firebase Component: Crashlytics & CloudMessagingReceiver
- Component version: "33.12.0" (FirebaseBOM)
[REQUIRED] Describe the problem
Firebase Background Thread #3 (runnable):tid=30 systid=3532
at java.lang.StringFactory.newStringFromBytes(StringFactory.java:137)
at java.lang.StringFactory.newStringFromBytes(StringFactory.java:61)
at sun.security.util.ManifestDigester.<init>(ManifestDigester.java:137)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:290)
at java.util.jar.JarVerifier.update(JarVerifier.java:229)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:393)
at java.util.jar.JarFile.getInputStream(JarFile.java:460)
at libcore.io.ClassPathURLStreamHandler$ClassPathURLConnection.getInputStream(ClassPathURLStreamHandler.java:162)
at java.net.URL.openStream(URL.java:1072)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:989)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController.getResourceAsStream(CrashlyticsController.java:660)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController.getVersionControlInfo(CrashlyticsController.java:642)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController.saveVersionControlInfo(CrashlyticsController.java:623)
at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.doBackgroundInitialization(CrashlyticsCore.java:239)
at com.google.firebase.crashlytics.internal.common.CrashlyticsCore.lambda$doBackgroundInitializationAsync$0(CrashlyticsCore.java:227)
at com.google.firebase.crashlytics.internal.concurrency.CrashlyticsWorker.lambda$submit$1(CrashlyticsWorker.java:96)
at com.google.android.gms.tasks.zze.run(zze.java:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:47)
at java.lang.Thread.run(Thread.java:923)
&&
main (blocked):tid=1 systid=3284 | waiting to lock <0x0a0484e2> (java.util.jar.JarFile) held by thread 30
at java.util.zip.ZipFile.getEntry(ZipFile.java:357)
at java.util.jar.JarFile.getEntry(JarFile.java:250)
at libcore.io.ClassPathURLStreamHandler.getEntryUrlOrNull(ClassPathURLStreamHandler.java:59)
at dalvik.system.DexPathList$Element.findResource(DexPathList.java:781)
at dalvik.system.DexPathList.findResource(DexPathList.java:555)
at dalvik.system.BaseDexClassLoader.findResource(BaseDexClassLoader.java:254)
at java.lang.ClassLoader.getResource(ClassLoader.java:793)
at java.lang.Class.getResource(Class.java:2259)
at com.pairip.VMRunner.executeVM(Native method)
at com.pairip.VMRunner.invoke(VMRunner.java:66)
at com.google.android.gms.cloudmessaging.CloudMessagingReceiver.onReceive(CloudMessagingReceiver.java)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:4032)
at android.app.ActivityThread.access$1400(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Hi @shabinder-singh, thank you for raising the issue. According to our Eng, this is a confirmed issue. The Firebase Crashlytics, is trying to read a java resource out of the apk in the background, and is blocking the access to the apk until the read is done. Then when something else tries to read anything from the apk, it is blocked. Thus, causing the ANR.
Our engineers are already working on this. For now, you can use the workaround below:
Workaround: Populate at build time the git hash. You can get it from git rev-parse HEAD and build it into your build.
i.e In app/src/main/res/values/strings.xml:
<resources>
...
<string name="com.google.firebase.crashlytics.version_control_info">"repositories {\n system: GIT\n local_root_path: \"$PROJECT_DIR\"\n revision: \"01a79b060c7d7d3a45694a03dc54a04b03b0b81d\"\n}\n"</string>
</resources>
Note the "$PROJECT_DIR" is the literal string, not meant to be evaluated.
Or if you’re not use App Quality Insights, you could just make it an empty like this:
<resources>
...
<string name="com.google.firebase.crashlytics.version_control_info">"repositories {\n system: GIT\n local_root_path: \"$PROJECT_DIR\"\n revision: \"\"\n}\n"</string>
</resources>
Let me know how it goes, or if there's any misunderstanding.
Hey @shabinder-singh. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
not stale, being worked on by firebase team.
This is fixed in the latest version of the Crashlytics Gradle plugin, 3.0.5
Please upgrade, and if the issue persists feel free to open a new issue