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

BackgroundListener$checkAppInBackground scheduled N times #2182

Closed
pyricau opened this issue Sep 30, 2021 · 2 comments · Fixed by #2362
Closed

BackgroundListener$checkAppInBackground scheduled N times #2182

pyricau opened this issue Sep 30, 2021 · 2 comments · Fixed by #2362
Milestone

Comments

@pyricau
Copy link
Member

pyricau commented Sep 30, 2021

Was just looking at a random Espresso report and noticed this:

Looper (main, tid 1) {5edfd65}
  Message 0: ...
  Message 1: { when=+1s743ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 2: { when=+2s807ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 3: { when=+2s807ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 4: { when=+2s807ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 5: { when=+2s807ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 6: { when=+3s742ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 7: { when=+3s742ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 8: { when=+3s742ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 9: { when=+3s743ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 10: { when=+4s718ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 11: { when=+4s847ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 12: { when=+4s847ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 13: { when=+4s847ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
  Message 14: { when=+4s848ms callback=leakcanary.internal.BackgroundListener$checkAppInBackground$1 target=android.os.Handler }
@pyricau
Copy link
Member Author

pyricau commented Jan 4, 2022

Ah, this is most likely a bug on our end when using BackgroundListener, likely creating a new instance for every test.

@pyricau
Copy link
Member Author

pyricau commented Jan 25, 2022

Actually, there's most likely a bug in LeakCanary as well

=> in uninstall we should make sure to cancel the posted runnable, otherwise every app scope schedules a new set.

@pyricau pyricau added this to the 2.9 milestone Apr 15, 2022
pyricau added a commit that referenced this issue Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant