Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't call Class.getResourceAsStream in firebase-iid #1601

Closed
yogurtearl opened this issue May 28, 2020 · 5 comments
Closed

Don't call Class.getResourceAsStream in firebase-iid #1601

yogurtearl opened this issue May 28, 2020 · 5 comments

Comments

@yogurtearl
Copy link

[REQUIRED] Step 2: Describe your environment

  • Firebase Component: com.google.firebase:firebase-iid
  • Component version: 20.1.2

[REQUIRED] Step 3: Describe the problem

Class.getResourceAsStream is very slow on Android, should instead load from Android Resource Manager.

Also, Android API 23 has a race condition with Class.getResourceAsStream that causes a ConcurrentModificationException

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
at java.util.HashMap$KeyIterator.next(HashMap.java:814)
at java.util.jar.JarVerifier.readCertificates(JarVerifier.java:266)
at java.util.jar.JarFile.getInputStream(JarFile.java:380)
at libcore.net.url.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:222)
at java.net.URL.openStream(URL.java:470)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:444)
at java.lang.Class.getResourceAsStream(Class.java:1169)
at com.google.android.gms.common.internal.LibraryVersion.getVersion(Unknown Source)
at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.2:61)
at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.2:89)
at com.google.firebase.iid.zzv.run(com.google.firebase:firebase-iid@@20.1.2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)```
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@ashwinraghav
Copy link
Contributor

Thanks for the report. Couple of other cases seem to confirm your observation too: 1, 2

@yogurtearl
Copy link
Author

yogurtearl commented Jun 4, 2020

@ashwinraghav @welishr did this get fixed? :)

@ashwinraghav
Copy link
Contributor

Oops I merged the change. But GitHub did its thing. I expect this to be rolled out on June 18 as firebase-messaging":20.2.1.

@ashwinraghav ashwinraghav reopened this Jun 4, 2020
@ashwinraghav
Copy link
Contributor

Fixed in today's release. Thanks for reporting!

@firebase firebase locked and limited conversation to collaborators Jul 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants