Closed Bug 1991327 Opened 7 months ago Closed 2 months ago

firefox background gif maxing out ram while idle in the background

Categories

(Firefox :: New Tab Page, defect)

Firefox 143
defect

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: floperatox.spam, Assigned: thecount)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0

Steps to reproduce:

  1. With the new feature, put a gif as the background in my firefox home page.
  2. Minimize the firefox window / Put another fullscreen window on top of it.
  3. Watch your memory (ram) slowly being maxing out.

Actual results:

When a gif is setup as my background image, all of my ram being used as soon as firefox is hidden in background, until firefox or my computer crashs.

Expected results:

No big specifique ram usage.

Group: firefox-core-security
Component: Untriaged → New Tab Page

Trying this locally, I think I might be doing it wrong.

How large is the gif, I tried with a 20MB gif.

How long do I need to keep it minimized before I start to see issues? I watched for like 5 mins, but is this more like a few hours?

I'll keep looking around for the root cause in the meantime.

(In reply to Scott [:thecount] Downe from comment #1)

Trying this locally, I think I might be doing it wrong.

How large is the gif, I tried with a 20MB gif.

How long do I need to keep it minimized before I start to see issues? I watched for like 5 mins, but is this more like a few hours?

I'll keep looking around for the root cause in the meantime.

Hello ! Unfortunately, I’m no longer able to reproduce the bug despite using the same gif and following the same procedure. I am confused.
The gif was about 116MB in size, and my RAM usage used to increase rapidly (around 50 MB/s, if I remember correctly) right after minimizing the browser.
Maybe as this been patched in recents updates (although I didn't notice anything related in the patch notes).
Sorry for the inconvenience.

Ok, I managed to reproduce it again.
I’m using the Windows 10 Task Manager to monitor RAM usage, and minimizing Firefox while having a gif set as the new tab background increases my overall system RAM usage, without affecting Firefox’s own memory usage (according to Task Manager).
From my tests, the heavier the gif, the faster the RAM usage increases.

That's what I've been trying. I am not able to reproduce as of yet. I believe you, and there have been other reports of this issue.

I assume for you the gif does not matter, and this happens almost immediately.

however, I'm going try different gifs, and leaving it on overnight, see if that helps trigger it.

I seem to be having better luck with a 50mb gif wallpaper.

The memory usage does seem to eventually stabilize, or at least slows down.

I think though this is bad enough that I can look into this, and hopefully it's the same issue others are experiencing.

I seem to only be able to reproduce something like this on release.

Looks like on nightly this may have been fixed.

On release I played around with a few different options, and I also think I can fix it by changing the gif background wallpaper from background-attachment: fixed; to background-attachment: scroll; (anything not fixes really), and that also seems to fix it. (but breaks the wallpaper in other ways).

But I'm not able to reproduce all that consistently, even with a 500mb gif.

If this is in fact fixed on nightly, then we shouldn't need to change anything.

Managed to reproduce on nightly.

I think just sometimes it's not consistent for me.

I see some other weird things happening when I set a gif wallpaper that I can track down.

See Also: → 1976603
See Also: → 1548683

The severity field is not set for this bug.
:thecount, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(sdowne)

Thanks for the details provided so far. To help reproduce this issue consistently, could you provide a bit more information?

  • the exact GIF file (or a link) that causes the issue
  • how long Firefox needs to be minimized before the RAM usage spikes
  • whether this happens with only the new tab page open or if other tabs are also open
  • any settings or extensions that might be related

If possible, could you also try reproducing this in Troubleshoot Mode and let us know if the issue still occurs?

Flags: needinfo?(floperatox.spam)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:thecount, since the bug has recent activity, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(floperatox.spam) → needinfo?(sdowne)
Assignee: nobody → sdowne
Attachment #9523018 - Attachment description: WIP: Bug 1991327 - Newtab testing a fix for preloaded tabs and render layers. → Bug 1991327 - Newtab testing a fix for preloaded tabs and render layers.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9520491 - Attachment is obsolete: true
Attachment #9523018 - Attachment description: Bug 1991327 - Newtab testing a fix for preloaded tabs and render layers. → Bug 1991327 - Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers.
Blocks: 2015908
Pushed by sdowne@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e9a142bd55cf https://hg.mozilla.org/integration/autoland/rev/548721cff6e0 Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley
Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f7f536cd61af https://hg.mozilla.org/integration/autoland/rev/3d33af4581e4 Revert "Bug 1991327 - Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley" for causing bc leak failures
Attachment #9523018 - Attachment description: Bug 1991327 - Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. → Bug 1991327 - Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley
Pushed by sdowne@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/107ec6a67c0c https://hg.mozilla.org/integration/autoland/rev/957c9324ded2 Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley
Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/fe3fec2a1a94 https://hg.mozilla.org/integration/autoland/rev/2f122c5242dd Revert "Bug 1991327 - Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley" for causing bc failures @ browser_animatedImageLeak.js

browser_animatedImageLeak.js is a test I wrote specifically for this exact problem in different situations (animated images running in various scenarios where they aren't visible like minimized and leaking memory), let me know if you need any help with the test. In fact it might be good to modify that test to test the scenario in this bug so that we don't accidentally regress it.

Yeah I might need help, when I fixed up the last test failure for the last backout, I got it passing locally.

So if it's failing again, or still, it may not be happening to me locally which is going to make it harder to fix.

Flags: needinfo?(sdowne)

Essentially the off screen pre loaded newtab needs renderLayers set to true so when we write it, it's fast and doesn't produce a noticeable flicker or load.

This also means when the page is minimized, and a gif is set as the wallpaper, the gif goes wild and causes a memory leak.

My current attempt to fix it is to set renderLayers to false if the browser is minimized of fully occluded, and it it back to true if it's visible again.

Looking at this again today, I think I got the test to fail locally. I think the key was not using --headless. Makes a lot of sense as it's probably changing the occluded state?

Yeah that wasn't it. I suspect I need a debug build, so trying that now.

Yup, a debug build triggered the same error locally and I was able to experiment and get a fix up. That test is now passing locally.

Essentially I think I still had some references kicking around, so I made some of them weak/scoped.

@tnikkel if you get a chance, no rush, to take a look that would be great.

Flags: needinfo?(tnikkel)

I don't know the browser front end code but making references weak totally makes sense as a fix. And the test itself only runs in debug mode because it depends on some code that is debug only so that explains what you observed. If the test passes when you push to try it should be good.

Flags: needinfo?(tnikkel)
Pushed by sdowne@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a18b6a844c02 https://hg.mozilla.org/integration/autoland/rev/3886496e82b1 Newtab turn off renderLayers on preloaded newtabs if the window is minimized or fully occluded, to fix a memory leak in newtab gif wallpapers. r=tabbrowser-reviewers,home-newtab-reviewers,sthompson,maxx,mconley
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: