Closed Bug 914421 Opened 11 years ago Closed 3 years ago

BrowserApp does not properly clean up on shutdown

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: mcomella, Unassigned)

Details

Notably the observers registered in BrowserApp.startup(...) [1] are missing from BrowserApp.shutdown(...) [2].

[1]: https://hg.mozilla.org/mozilla-central/file/b1b292d8e383/mobile/android/chrome/content/browser.js#l262
[2]: https://hg.mozilla.org/mozilla-central/file/b1b292d8e383/mobile/android/chrome/content/browser.js#l644

mbrubeck said we may be able to pass ownsWeak=true to addObserver, rather than making many removeObserver calls.

There may be other things that we're not cleaning up properly so it may be worth investigating further for BrowserApp (and other systems), particularly becouse, as nalexander puts it: "Understanding these lifecycles is hard, and changing as we add background services, rework our activity flow, and implement geckoview."
I'm not against the cleanup, but I think part of the reason we see the disconnect is: What bad things will happen if we miss shutdown?
* We are closing the window, and presumably the app
* Android will likely kill us without ever getting to shutdown

It's true this could become a different story in the future. I might predict that adding the ability to use multiple GeckoViews in an app would mean multiple browser.js windows being created. In this case, we might see a benefit from having proper cleanup.
Something worth tracking?
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.