Closed Bug 1167818 Opened 10 years ago Closed 10 years ago

[e10s] background tabs use CPU as though they're in foreground, following "Restore All Crashed Tabs"

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 41
Tracking Status
e10s m8+ ---
firefox41 --- fixed

People

(Reporter: dbaron, Assigned: ttaubert)

Details

(Keywords: perf, power)

Attachments

(1 file)

I'm using a Linux debug build, self-built, mozilla-central. I just hit a child process crash, and hit the "Restore All Crashed Tabs". After everything was recovered, I noticed Firefox was using way more CPU than I'd expect given the set of tabs. I poked at the child process in gdb; it was spending time refresh driver ticks for various background tabs, including painting-related stuff. (Some of these tabs had various visual animations in them.) When I used Ctrl+PgDn to cycle through all the tabs, then the high CPU usage stopped. I'm guessing that following a "Restore All Crashed Tabs", we're not correctly restoring state that knows whether a tab is in the background, and we're doing too much work as a result. I'm not sure if that state is the state that flows through nsDocShell::SetIsActive (which should get to the refresh driver via SetIsActive itself or PresShell::QueryIsActive, to PresShell::SetIsActive, to nsRefreshDriver::SetThrottled, to nsRefreshDriver::ChooseTimer) or whether it's something else.
Tim, any chance you could look into this?
Component: Document Navigation → Session Restore
Flags: needinfo?(ttaubert)
Product: Core → Firefox
Assignee: nobody → ttaubert
Status: NEW → ASSIGNED
Flags: needinfo?(ttaubert)
We set browser.docShellIsActive=false in addTab() because we know a new docShell/frameLoader just got created. When switching remoteness when navigating (or after a tab crashed to load about:tabcrashed) we don't. This patch does exactly that and I can't reproduce the issue anymore.
Attachment #8612409 - Flags: review?(wmccloskey)
Comment on attachment 8612409 [details] [diff] [review] 0001-Bug-1167818-Update-docShellIsActive-flag-after-a-bro.patch Review of attachment 8612409 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/base/content/tabbrowser.xml @@ +1510,5 @@ > > + // Switching a browser's remoteness will create a new frameLoader. > + // As frameLoaders start out with an active docShell we have to > + // deactivate it if this is not the selected tab's browser or the > + // browser windows minimized. Changed that to "browser window is minimized."
Comment on attachment 8612409 [details] [diff] [review] 0001-Bug-1167818-Update-docShellIsActive-flag-after-a-bro.patch Review of attachment 8612409 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! ::: browser/base/content/tabbrowser.xml @@ +1511,5 @@ > + // Switching a browser's remoteness will create a new frameLoader. > + // As frameLoaders start out with an active docShell we have to > + // deactivate it if this is not the selected tab's browser or the > + // browser windows minimized. > + aBrowser.docShellIsActive = (aBrowser == this.selectedBrowser && It seems safer to me to copy the docShellIsActive property from the old browser. But this should work too.
Attachment #8612409 - Flags: review?(wmccloskey) → review+
(In reply to Bill McCloskey (:billm) from comment #4) > > + aBrowser.docShellIsActive = (aBrowser == this.selectedBrowser && > > It seems safer to me to copy the docShellIsActive property from the old > browser. But this should work too. Yeah indeed. We can do that once remote browser support the docShellIsActive getter :/ https://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/remote-browser.xml#217
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: