Closed
Bug 1078448
Opened 10 years ago
Closed 7 years ago
Callscreen app instances linger in bfcache after being closed
Categories
(Firefox OS Graveyard :: Gaia::Dialer, defect)
Firefox OS Graveyard
Gaia::Dialer
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: drs, Unassigned)
References
Details
(Whiteboard: [planned-sprint c=6])
Attachments
(3 files, 5 obsolete files)
When the callscreen closes because all calls have ended, we kill the app and restart it with no calls. While investigating bug 1070066, we found that the old instances linger in the bfcache.
In particular, see the conversation beginning at bug 1070066 comment 19.
Flags: needinfo?(bugs)
Comment 1•10 years ago
|
||
I don't know what I should say here.
Are we sure those window objects are in bfcache?
Has anyone tried to explicitly disable bfcache for callscreen?
(add dummy unload event listener)
Flags: needinfo?(bugs)
Comment 2•10 years ago
|
||
I'll take the liberty of need-infoing Doug regarding comment 1 ;)
Flags: needinfo?(drs+bugzilla)
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → drs+bugzilla
Flags: needinfo?(drs+bugzilla)
Whiteboard: [planned-sprint c=]
Target Milestone: --- → 2.1 S7 (24Oct)
Reporter | ||
Updated•10 years ago
|
Whiteboard: [planned-sprint c=] → [planned-sprint c=3]
Reporter | ||
Updated•10 years ago
|
Whiteboard: [planned-sprint c=3] → [planned-sprint c=1]
Comment 3•10 years ago
|
||
I tried adding a dumb listener on the "unload" event, to see if it helps with bug 1081714, but so far it does nothing and I still see a lot of DOMWINDOW callscreen.
Comment 4•10 years ago
|
||
Doug, I have some PR to submit, sorry for stealing this :)
Assignee: drs+bugzilla → lissyx+mozillians
Comment 5•10 years ago
|
||
With this change, I'm not able to reproduce anymore bug 1074379 and bug 1081714, as documented on bug 1074379 comment 44 and bug 1074379 comment 45.
Comment 6•10 years ago
|
||
We don't see anymore callscreen leaking in this memory report done after running the 50 voicemail calls UI test.
Comment 7•10 years ago
|
||
[Blocking Requested - why for this release]: if it's confirmed to be fixing bug 1081714 and bug 1074379, those two are 2.1+
blocking-b2g: --- → 2.1?
Updated•10 years ago
|
Assignee: lissyx+mozillians → nobody
blocking-b2g: 2.1? → ---
Component: Gaia::Dialer → Event Handling
Product: Firefox OS → Core
Target Milestone: 2.1 S7 (24Oct) → ---
Comment 8•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #1)
> I don't know what I should say here.
>
> Are we sure those window objects are in bfcache?
>
> Has anyone tried to explicitly disable bfcache for callscreen?
> (add dummy unload event listener)
Yes, that does the trick. I'm resetting this bug to track the underlying platform issue, and I'll file a followup to use this workaround for now in Gaia.
Flags: needinfo?(bugs)
Comment 10•10 years ago
|
||
The fact the pages may go to bfcache?
Comment 13•10 years ago
|
||
[Blocking Requested - why for this release]: This patch fixes bug 1074379 and bug 1081714 which were both 2.1 blockers. Carrying the status of them to that bug.
blocking-b2g: --- → 2.1?
Comment 14•10 years ago
|
||
Is anyone doing some investigation into the underlying platform problem? We are seeing other problems with pages not loading, like bug 1080753.
Flags: needinfo?(lissyx+mozillians)
Flags: needinfo?(drs.bugzilla)
Reporter | ||
Comment 15•10 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #14)
> Is anyone doing some investigation into the underlying platform problem? We
> are seeing other problems with pages not loading, like bug 1080753.
Not that I'm aware of.
Flags: needinfo?(drs.bugzilla) → needinfo?(bugs)
Comment 16•10 years ago
|
||
No, I don't know bfcache and I'm already busy with settings.
Flags: needinfo?(lissyx+mozillians)
Comment 17•10 years ago
|
||
Some answer to comment 9 and comment 10 would be nice. I really don't understand what the platform issue is here. Do we have some APIs which haven't been designed so that the page can be in bfcache, yet the implementation doesn't prevent bfcache on the pages they are used or what?
(I don't know which APIs are being used in Callscreen app)
Flags: needinfo?(bugs)
Reporter | ||
Comment 20•10 years ago
|
||
We worked around this issue in bug 1083729 to fix bug 1074379, and bug 1081714. Thus I don't think this should be a blocker.
Reporter | ||
Comment 21•10 years ago
|
||
Based on my discussion with Olli, it seems that this is expected behavior, and I agree.
Here, we reload the Callscreen window from the System app:
https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/callscreen_window.js#L152
Olli says that we can remove the Callscreen iframe and re-add it back to the document. This destroys and recreates the DocShell, and the bfcache along with it.
Component: Event Handling → Gaia::Dialer
Product: Core → Firefox OS
Target Milestone: --- → 2.1 S8 (7Nov)
Comment 23•10 years ago
|
||
I still think we should be investigating the platform issue as a 2.1+ blocker here. This may be causing other problems in gaia.
Comment 24•10 years ago
|
||
I'm investigating this a bit, but so far I haven't really seen any real platform issue.
System app just loads a page, then about:blank, then a page ,then about:blank and so on.
But we could possibly clean up session history/bfcache in the relevant iframe had some specific
attribute. (I was first thinking not using bfcache for mozbrowser things, but apparently we're dealing with a mozbrowser iframe here, and bfcache is very useful in the normal browsing case.)
But perhaps mozapp should disabled bfcache? I never remember how mozbrowser and mozapp are related to each other (like, when do we need mozapp)
Comment 25•10 years ago
|
||
Bfcache is very useful, and I think we should be moving to a state where we have *more* of it, not less. I have a hunch that bug 1080753 is being caused by the same issue here though, still investigating.
Comment 26•10 years ago
|
||
Oops, forgot to mention that bug 1080753 has problems when dealing with web content, in a non-mozapp state.
Comment 27•10 years ago
|
||
So in normal context we wouldn't use bfcache for iframe, but the whole point of
mozbrowser/app is that iframe starts to behave as a top level browsing context and we do have
bfcache enabled.
Setting browser.sessionhistory.max_total_viewers to 0 should disable the whole bfcache.
Perhaps we want that in the parent process and child processes could have
browser.sessionhistory.max_total_viewers 1 (b2g.js has 1 for that).
Comment 28•10 years ago
|
||
Also, if one wants to explicitly do some bfcache eviction, there are various
nsISHistoryInternal.evict*() methods for that.
Comment 29•10 years ago
|
||
Also, for b2g we probably want shorter timeout here
http://mxr.mozilla.org/mozilla-central/source/docshell/shistory/src/nsSHEntryShared.cpp#29
Reporter | ||
Updated•10 years ago
|
Assignee: nobody → thills
Updated•10 years ago
|
Status: NEW → ASSIGNED
Comment 30•10 years ago
|
||
WIP patch for feedback. Couple of notes:
1) removed the workaround in index.js.
2) I have a doubt about whether the _unregisterEvents is necessary. My concern was that we'll be leaking the events if we constantly re-register them without unregistering.
Thanks,
-tamara
Attachment #8513472 -
Flags: feedback?(drs.bugzilla)
Reporter | ||
Comment 31•10 years ago
|
||
Comment on attachment 8513472 [details] [diff] [review]
WIP patch for feedback
Review of attachment 8513472 [details] [diff] [review]:
-----------------------------------------------------------------
::: apps/system/js/app_window.js
@@ +1011,5 @@
> + this.constructor.REGISTERED_EVENTS.forEach(function iterator(evt) {
> + this.debug('removing ' + evt + ' event handler ...');
> + this.element.removeEventListener(evt, this);
> + }, this);
> + };
From my memory profiling, it looks like we missed this originally. I'm not sure where the additional listeners are being registered from, though. It seems that they will only be attached when we call `this.render()`. Please investigate this further.
::: apps/system/js/callscreen_window.js
@@ +165,5 @@
> + }
> + }
> + }
> +
> + this.render();
This is overly complicated. All we have to do is detach `this.browser.element` from its parent and then re-attach it.
Attachment #8513472 -
Flags: feedback?(drs.bugzilla) → feedback-
Comment 32•10 years ago
|
||
Hi Doug,
I did more investigation on eventListeners all around.
1. After looking at the memory profiles, I don't have any evidence that we are leaking eventListeners in the Callscreen due to the changes.
2. After looking at the memory profiles on the system, I don't believe it's necessary to unregister the eventListeners. I removed that and did not find any evidence that we are leaking them on system and found the code to be unnecessary.
As for the other listeners in system, each Window app that inherits itself from AppWindow.js has a list of REGISTERED_EVENTS... Callscreen's is a copy of what AttentionWindow's is. there are close to 1000 eventListeners registered before we even make a call. When I looked at stacktrace for AppWindow._registerEvents HomeScreenWindow was one of the ones that also called this function.
There are probably tons more eventListeners in system not coming from _registerEvents, but there is no way to get a list of all the eventListeners from the memory tool, just a count.
Thanks,
-tamara
Attachment #8513472 -
Attachment is obsolete: true
Attachment #8514419 -
Flags: feedback?(drs.bugzilla)
Reporter | ||
Comment 33•10 years ago
|
||
Comment on attachment 8514419 [details] [diff] [review]
WIP 1078448v3.diff
Review of attachment 8514419 [details] [diff] [review]:
-----------------------------------------------------------------
Looks reasonable. When we're ready to go into review with this, we should flag Etienne as well.
Attachment #8514419 -
Flags: feedback?(drs.bugzilla) → feedback+
Comment 34•10 years ago
|
||
Are we still not doing investigation into the platform issue here? Are we sure that this can't impact other apps?
Comment 35•10 years ago
|
||
Attachment #8518533 -
Flags: review?(drs.bugzilla)
Attachment #8518533 -
Flags: feedback?(etienne)
Reporter | ||
Comment 36•10 years ago
|
||
Comment on attachment 8518533 [details] [review]
PR
See my comments on the PR.
(In reply to Kevin Grandon :kgrandon from comment #34)
> Are we still not doing investigation into the platform issue here? Are we
> sure that this can't impact other apps?
Setting ni on myself to file bugs and do a writeup on this.
Flags: needinfo?(drs.bugzilla)
Attachment #8518533 -
Flags: review?(drs.bugzilla)
Attachment #8518533 -
Flags: review-
Attachment #8518533 -
Flags: feedback?(etienne)
Reporter | ||
Updated•10 years ago
|
Whiteboard: [planned-sprint c=1] → [planned-sprint c=1][in-sprint=v2.1-S8]
Target Milestone: 2.1 S8 (7Nov) → 2.1 S9 (21Nov)
Comment 37•10 years ago
|
||
Hi Doug,
I updated the PR with changes to the test to use validate the iframe is removed/added, vs. using the spies.
To address your comment about the setTimeout. I don't believe we need this for the functionality as I tested without it and saw no leaks and everything seemed to function fine. It was there in the code, so I did not remove it as there could be something we're not aware of. Also, I suspect it may have been there to help with the testing.
Thanks,
-tamara
Attachment #8505522 -
Attachment is obsolete: true
Attachment #8514419 -
Attachment is obsolete: true
Attachment #8525045 -
Flags: review?(drs.bugzilla)
Reporter | ||
Comment 38•10 years ago
|
||
Comment on attachment 8525045 [details] [review]
Updated PR after last review
Please rebase this before we review it.
Attachment #8525045 -
Flags: review?(drs.bugzilla)
Comment 39•10 years ago
|
||
Hi Doug,
This is updated PR after rebasing and retesting bug 834530 to make sure it still works after rebase.
Thanks,
-tamara
Attachment #8525045 -
Attachment is obsolete: true
Attachment #8525385 -
Flags: review?(drs.bugzilla)
Reporter | ||
Comment 40•10 years ago
|
||
Comment on attachment 8525385 [details] [review]
updated PR after rebase
Looks good! I left some nit-picky comments on the PR. Please address them and then we'll merge.
As I said, we'll have to discuss the platform side of this more. Leaving my ni for now.
Please remember to make a demo and put it on the sprint demo page:
https://wiki.mozilla.org/FirefoxOS/Comms/Dialer/Sprint/v2.1-S9#Demos
Flags: needinfo?(thills)
Attachment #8525385 -
Flags: review?(drs.bugzilla) → review+
Comment 41•10 years ago
|
||
Hi Doug,
I had a broken test in index_test.js. This update has that fixed.
Thanks,
-tamara
Attachment #8525385 -
Attachment is obsolete: true
Attachment #8526341 -
Flags: review?(drs.bugzilla)
Reporter | ||
Comment 42•10 years ago
|
||
Comment on attachment 8526341 [details] [review]
Update to patch -- broken test
In the future, please try to remember to include changes as additional commits. I'm assuming that the only changes were to 'index_test.js'.
I left one nit comment on the PR, but it otherwise looks good.
Attachment #8526341 -
Flags: review?(drs.bugzilla) → review+
Comment 43•10 years ago
|
||
https://github.com/mozilla-b2g/gaia/commit/a445aec48e9260d3e4b3f6980de73b90f7f99314
https://treeherder.mozilla.org/ui/#/jobs?repo=gaia-try&revision=d9f1a9b8e069
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(thills)
Resolution: --- → FIXED
Reporter | ||
Comment 44•10 years ago
|
||
Backed out: https://github.com/mozilla-b2g/gaia/commit/a3e2f4d39082ffc0ee67c72c48d6e7be2486010e
For causing bug 1105747.
Reporter | ||
Updated•10 years ago
|
Flags: needinfo?(drs.bugzilla)
Whiteboard: [planned-sprint c=1][in-sprint=v2.1-S8] → [c=1][in-sprint=v2.1-S9]
Target Milestone: 2.1 S9 (21Nov) → 2.2 S1 (5dec)
Reporter | ||
Comment 46•10 years ago
|
||
Olli suggested calling `nsIDocument::DisableBFCaching()` from somewhere in Gecko to disable the BFCache for System iframes, which I believe would fix this issue and any others like it. Unfortunately, I don't know enough about the Gecko code that supports the System app to know where this would go. Kevin, do you know who we could talk with about this?
Flags: needinfo?(drs.bugzilla) → needinfo?(kgrandon)
Comment 47•10 years ago
|
||
(In reply to Doug Sherk (:drs) (use needinfo?) from comment #46)
> Olli suggested calling `nsIDocument::DisableBFCaching()` from somewhere in
> Gecko to disable the BFCache for System iframes,
Well, to be precise I suggested calling DisableBFCaching in the API implementation of the thing
callscreen uses. If the API implementation can't deal with pages being in bfcache, it should disable bfcache.
(I don't know which all APIs callscreen uses.).
Comment 48•10 years ago
|
||
Callscreen just uses a mozapp="", no? I suppose we could potentially disable it, or maybe create some new iframe property to disable it? I don't really know that code all too well though.
I'm not sure if it's realted or not, but I've just filed bug 1106280 which I think could be due to some bfcache bug?
Flags: needinfo?(kgrandon)
Comment 49•10 years ago
|
||
I mean the API which one can use to answer to a call and so. What is actually causing the issues?
Usually web pages work just fine when they enter to bfcache.
Reporter | ||
Updated•10 years ago
|
Whiteboard: [c=1][in-sprint=v2.1-S9] → [planned-sprint c=?]
Target Milestone: 2.2 S1 (5dec) → 2.2 S4 (23jan)
Reporter | ||
Updated•10 years ago
|
Whiteboard: [planned-sprint c=?] → [planned-sprint c=6]
Reporter | ||
Updated•10 years ago
|
Target Milestone: 2.2 S4 (23jan) → 2.2 S5 (6feb)
Reporter | ||
Updated•10 years ago
|
Target Milestone: 2.2 S5 (6feb) → 2.2 S6 (20feb)
Reporter | ||
Updated•10 years ago
|
Target Milestone: 2.2 S6 (20feb) → ---
Updated•9 years ago
|
Assignee: thills → administration
Comment 50•7 years ago
|
||
Firefox OS is not being worked on
Status: REOPENED → RESOLVED
Closed: 10 years ago → 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•