FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

Leak detected with LeakCanary

Open ArcherEmiya05 opened this issue 3 years ago • 4 comments

Step 1: Are you in the right place?

Yes

Step 2: Describe your environment

  • Android device: Redmi Note 5
  • Android OS version: 5.0
  • Google Play Services version: 4.3.5
  • Firebase/Play Services SDK version: 20.0.4
  • FirebaseUI version: 7.1.1

Step 3: Describe the problem:

When closing the app this leak shows frequently even though there is no listener at all

Steps to reproduce:

  1. Add LeakCanary to app
  2. Implement Firebase Auth UI (PhoneAuth)
  3. Try to test it by logging in then open and close the app

Observed Results:

04-29 02:24:27.780 12111-12111/com.myapp.com D/LeakCanary: ​
  ┬───
  │ GC Root: Global variable in native code
  │
  ├─ com.google.firebase.auth.api.fallback.service.zza instance
  │    Leaking: UNKNOWN
  │    Retaining 506 B in 11 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 and Service not held by ActivityThread)
  ​     Retaining 478 B in 10 objects
  ​     key = ac038340-ead9-4df3-856e-d554d8a60d6b
  ​     watchDurationMillis = 5224
  ​     retainedDurationMillis = 219
  ​     mApplication instance of com.myapp.com.App
  ​     mBase instance of android.app.ContextImpl
  
  METADATA
  
  Build.VERSION.SDK_INT: 21
  Build.MANUFACTURER: Xiaomi
  LeakCanary version: 2.7
  App process name: com.myapp.com
  Stats: LruCache[maxSize=3000,hits=122,misses=123181,hitRate=0%]
  RandomAccess[bytes=11632648,reads=123181,travel=39030419727,range=42073912,size=55116410]
  Heap dump reason: 1 retained objects, app is not visible
  Analysis duration: 30287 ms

Expected Results:

No leak

Relevant Code:



private fun checkAuthStatus() {
      if (FirebaseAuth.getInstance().currentUser == null)
          startActivityForResult(authRequest(), authRequestCode)
      else
          startMain()
  }

private fun authRequest(): Intent {
      val builder = AuthUI.getInstance().createSignInIntentBuilder()
          .setTheme(R.style.AuthStyle)
          .setLogo(R.mipmap.ic_launcher)
          .setIsSmartLockEnabled(true)
          .setAvailableProviders(getProviderList())
      builder.setTosAndPrivacyPolicyUrls(
          "https://firebase.google.com/terms/",
          "https://firebase.google.com/policies/analytics"
      )
      return builder.build()
  }

  private fun getProviderList() : List<IdpConfig>{
      val providers: MutableList<IdpConfig> = ArrayList()

      providers.add(PhoneBuilder().build())
      return providers
  }

ArcherEmiya05 avatar Apr 28 '21 18:04 ArcherEmiya05

Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a +1 on this issue can help us prioritize adding this to the roadmap.

(Googler-only internal tracking bug: b/187073530)

yuchenshi avatar May 03 '21 18:05 yuchenshi

+1

adarsh-web avatar Dec 27 '21 12:12 adarsh-web

I am also having this issue

JamshedAlamQaderi avatar Jan 03 '23 05:01 JamshedAlamQaderi

+1

JamshedAlamQaderi avatar Jan 03 '23 05:01 JamshedAlamQaderi