firebase-android-sdk: FirebaseAuthFallbackService memory leak
[READ] Step 1: Are you in the right place?
yes
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 4.1.2 Stable
- Firebase Component: Firebase Authentication
- Component version: 20.0.2
[REQUIRED] Step 3: Describe the problem
LeakCanary is telling me that "FirebaseAuthFallbackService " is leaking. I just “AuthStateListener” in my ActivityClass which lives through the entire app lifecycle, to check if the user signed out. And “Firebase.auth” for taking currentUser instance. That’s all
Steps to reproduce:
Happening every time I open the app, sometimes when I close the app, sometimes when It goes to the background, LeakCanary starts dumping the heap and throwing this memory leak.
Relevant Code:
┬───
│ GC Root: Global variable in native code
│
├─ com.google.firebase.auth.api.fallback.service.zza instance
│ Leaking: UNKNOWN
│ Retaining 1.7 kB in 10 objects
│ zza instance of com.google.firebase.auth.api.fallback.service.
│ FirebaseAuthFallbackService
│ ↓ zza.zza
│ ~~~
╰→ com.google.firebase.auth.api.fallback.service.FirebaseAuthFallbackService
instance
Leaking: YES (ObjectWatcher was watching this because com.google.firebase.
auth.api.fallback.service.FirebaseAuthFallbackService received
Service#onDestroy() callback)
Retaining 1.2 kB in 9 objects
key = d411935b-9bcd-4a8d-8362-a6c8687aec0e
watchDurationMillis = 5285
retainedDurationMillis = 281
mApplication instance of com.upgrades.venue.pro.MainApplication
mBase instance of android.app.ContextImpl
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 69
- Comments: 75 (6 by maintainers)
I heard that they will assign this to a software engineer intern in summer of 2035
Today is Jan 1, 2022, the issue was reported on Jan 31, 2021…
After @malcolmdeck finished the refactoring, I am able to verify that the memory leak is no longer reproducible in the latest firebase-auth pre-release library. Will follow up here when the release goes out.
@malcolmdeck
Hey Malcolm, thank you for communicating the state of affairs. Much appreciated. I’m not sure if you know this, but Google Play punishes severely apps for exhibiting ANR behaviour. This bug persist for more than 9!!! months, in many cases it sends apps above “Bad behaviour threshold” and simply kills them - it infuences not just organic growth, it also kills paid Admob’s ads performance (since it’s also takes into account “app’s quality”). It’s need to be fixed or hotfixed now, we don’t care wether you’ll rewrite your “internal library” or implement some workaround, it should be resolved. This bug and how it’s handled so far, it’s simply unacceptable.
Hi all, thank you for your patience! The fix is finally out in Firebase Authentication version
21.0.2
. You may check out the release notes here. With that said, I’ll be closing this issue now. Feel free to open a new issue if there are any other concerns or questions. Thanks!Hey folks, Malcolm from the Firebase team here.
We are aware of this issue, and 3 different people have looked at it. A combination of the fact that this appears to be connected to an internal library that we depend on and the reproduction of the bug has weird interplay with our obfuscation pipeline is making this difficult for us to track down and fix. The only way we know for sure to fix this right now would be to rewrite a very large section of our library to not use that internal library (which may not fix the issue, but at least would make it easier to debug). We don’t really have the resources right now to do that, so we’re trying to see if we can figure out how to fix it without having to rewrite everything.
I know this is frustrating for you, and we’re doing the best we can. I’ll come back when I have something meaningful/new to share here. In the meantime, I appreciate your patience.
Is there any ETA for a fix or an older version we can revert to? I’m getting a lot of memory leak reports from leakcanary for this issue
As Malcolm mentioned in the comment, we have an on-going refactoring. We will update this thread once we test the refactoring and get it ready for release.
I’m just going to leave this here: https://twitter.com/Piwai/status/1473315039188762632
😉
Hi All, sorry for taking this long. This issue has been escalated with our engineering team, and we’ll provide an update as soon as possible. We thank you for your patience while we’re working on resolving this.
@yoyomyo Can you please give an estimation of the time frame that you expect to have a version with this problem fix, days, weeks or months? Because we have solutions that depended on this issue being fix, and this problem is making apps not working on some devices and get bad reviews because of it, and we need to know if we need to find a workaround or wait for a fix
The fix is not in 29.1.0 yet. Please be patient, as the BOM testing and release process can take some time. We will update this thread as soon as we have more details.
Hey firebase team will you address this issue? We are getting tons of ANR’s because of this! @vkryachko @schmidt-sebastian
The Firebase team should definitely fix this bug in FirebaseAuthFallbackService.
In the meantime, here’s how you can configure LeakCanary to stop tracking FirebaseAuthFallbackService:
First, disable the automatic install:
Then install LeakCanary manually in your debug application, ignoring FirebaseAuthFallbackService:
This issue is Causing ANR in my app
@vkryachko @schmidt-sebastian any update on this?
Why did this issue suddenly get traffic? I didn’t think it would help, but it seems like it does 😃
Hey folks, sorry that it’s taking this long. I’ve forwarded this issue to the Auth team, there is an internal bug tracking progress for this. cc @malcolmdeck
Thanks for your patience.
any progress? Any update?
+1
Hi @Jack29913 , as @aguatno mentioned, the issue is assigned and is being worked on at the moment. I know it’s been a while, so thanks for you patience.
I am getting this issue frequently whenever I am exiting the app or going into the background from my app. Refer below for heap analysis result:
Is there any progress on the fix of this issue?
Echoing @mohitrajput-trell - I’d love to test a patched build of this if information is forthcoming 😃
Is there any update on this issue? Which Firebase library version has fix of this issue?
Also experiencing this bug in a production app
[READ] Step 1: Are you in the right place?
yes
[REQUIRED] Step 2: Describe your environment
Android Studio version: 4.2 Beta 6 Firebase Component: Firebase Authentication Component version: 20.0.4
[REQUIRED] Step 3: Describe the problem
LeakCanary is telling me that "FirebaseAuthFallbackService " is leaking. Just add the firebase bom and firebase auth. Run the app with leak canary enabled, and bring the app to background.
Steps to reproduce:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
implementation platform('com.google.firebase:firebase-bom:27.0.0')
implementation 'com.google.firebase:firebase-auth-ktx'
Relevant Code: ==================================== HEAP ANALYSIS RESULT ==================================== 1 APPLICATION LEAKS