Firefox for Android uses too much energy when pages are open while the app is backgrounded

RESOLVED DUPLICATE of bug 1026669

Status

()

defect
RESOLVED DUPLICATE of bug 1026669
4 years ago
4 years ago

People

(Reporter: micmon, Unassigned)

Tracking

(Blocks 1 bug, {power})

42 Branch
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(fennec-)

Details

Attachments

(1 attachment)

Firefox for Android often drains the battery of my Nexus 5 in no time. See the attached screenshot for example. Starting with 100% charge my battery was at 22% when I noticed it about 2 hours later. There was only one page open [1] but the screen was off and I think Firefox was running in the background.

Firefox should really suspend web pages while the screen is off.

[1] https://groupees.com/bmle
I should mention that this was not the only time I ran into a problem like this. Closing pages before turning the screen of seems to work around the problem but this is not how I would like to use Firefox.
Blocks: powah
Severity: major → normal
Keywords: power
Summary: Uses too much energy while running in background → Firefox for Android uses too much energy when pages are open while the app is backgrounded
Firefox does slow down some parts of webpages when backgrounded. Intervals for timers are changed and animations should be paused.

We recently landed a fix for pausing service discovery while backgrounded in bug 1026669. This might be causing the problem you see. You can try disabling the "video casting" service and see if that helps:

* about:config
* find: "browser.casting.enabled"
* toggle to false
* press Android Home button, just to be sure the preference is saved
* restart Firefox

I can look at uplifting bug 1026669 as well.
Thanks, I will give this a try.
Well right now going to that page I linked as a test case triggers a device reboot after about 2minutes :(
I connected to the page remotely using a Nexus 4 and Firefox Desktop. Doing some profiling while the device was "sleeping" and didn't see the page doing any networking. I also didn't see much, if any JS code happening. While the page is in the foreground, there are almost constant setTimeouts and setIntervals.

We need to keep looking.
Michael, can you consistently reproduce this?

I wonder if Finkle was unable to reproduce because of some race condition.
(In reply to Michael Comella (:mcomella) from comment #6)
> Michael, can you consistently reproduce this?
> 
> I wonder if Finkle was unable to reproduce because of some race condition.

I fully charged my Nexus 4, opened the webpage in Nightly, put the phone to sleep and left it alone over night.

In the morning, I see the Nightly is using 23% of the power. Something is going on, but I don't know a good way to find out what that is.
(In reply to Michael Comella (:mcomella) from comment #6)
> Michael, can you consistently reproduce this?

At the moment I can reproduce the phone reboot nach time I visit that page. However this is after updating to Android 6...
I tried a variant of the experiment in comment 7. I fully charge the Nexus 4, disabled plugins in Nightly, visited the page and put the phone to sleep. In the morning, Nightly used 11% of the power and the phone still had ~78% charge.

This leads me to believe that Flash plugin uses are affecting power usage when in the background. I wonder if we can add support for throttling Flash when in the background, like we do for other features?
FYI I do not have flash installed
tracking-fennec: --- → ?
I did the experiment in comment 9 again, with an updated Nightly. I wanted to be sure I had bug 1026669 in the test. After letting the Nexus 4 sleep on battery overnight, Nightly is using 9% of the battery and the browser did not crash.
As far as the power usage, I think this fixed by bug 1026669. For crashes, I'd suggest opening a new bug.
Status: NEW → RESOLVED
tracking-fennec: ? → -
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1026669
You need to log in before you can comment on or make changes to this bug.