RAM usage grows too much on minimized browser window with sidebar panel containing APNG background
Categories
(Core :: Graphics: ImageLib, defect, P3)
Tracking
()
People
(Reporter: yuki, Assigned: emilio)
References
(Regressed 1 open bug)
Details
Attachments
(3 files)
Steps to reproduce
- Run Firefox on Windows.
- Go to
about:debugging
and load the attached testcase XPI as a temporary addon. - Ensure that the sidebar panel of the testcase addon is visible.
- Go to
about:processes
and memorize the PID of the "Extensions" process. - Hit Ctrl-Shift-ESC to open Task Manager of Windows.
- Switch to "Details" panel.
- Right-click on the header row and turn the "Working Set" column visible.
- See the process row of the PID memorized at the step 4.
- Minimize the browser window.
Expected result
The working set of the process does not grow.
Actual result
The working set of the process starts growing.
It would stop when you restore the window from minimized state.
Environment
- Windows 11 23H2
- Nightly 123.0a1 (build ID: 20240116050321)
Notes
The animation background image of the testcase is cited from the theme:
https://addons.mozilla.org/en-US/firefox/addon/a-n-i-m-a-t-e-d-kitty-cat/
I tried to create new APNG image to reproduce but I couldn't, so I just copied the file.
Here is the original bug report about this problem: https://github.com/piroor/treestyletab/issues/3413
Comment 1•2 years ago
|
||
Thanks for reporting. This sounds similar to an issue we were dealing with last year, perhaps there is another case that wasn't fixed.
Comment 2•2 years ago
|
||
I can reproduce on macOS.
Comment 3•2 years ago
|
||
The animated image is in a remote iframe uri moz-extension://6c35841f-7382-4b8f-9311-f838e4f0bc24/sidebar.html and it is in a content process. So I would guess that it's compositor does not get paused (like content tabs) but its refresh driver does not get throttled (unlike content tabs) so both fixes we did for this problem miss this case.
Comment 4•2 years ago
|
||
Options to fix:
- find some property in this process that mirrors the paused compositor from the parent
- create some property in this process that mirrors the paused compositor
- fix bug 1819154
Assignee | ||
Comment 5•2 years ago
|
||
Something like bug 1847600 but for the regular sidebar rather than the shopping sidebar would do too afaict.
Assignee | ||
Updated•2 years ago
|
Comment 6•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
Something like bug 1847600 but for the regular sidebar rather than the shopping sidebar would do too afaict.
I'm a bit lost - it looks to me like the issue here is a minimized parent window not causing stuff in child windows to pause - do we think it ought to be the responsibility of frontend code to do work there to pass along the "hey the parent widget window got minimized" state for all the remote children? I would have expected the graphics/core code to do this itself...
Comment 7•2 years ago
|
||
Feels like it would be more fool proof to have layout/gfx/core code do it to me, but I'm open to other thoughts/info.
Comment 8•2 years ago
|
||
(In reply to YUKI "Piro" Hiroshi from comment #0)
I tried to create new APNG image to reproduce but I couldn't, so I just copied the file.
Probably because the animated images needs to be above a certain total size so that we only keep around a subset of the image frames instead of all of them to trigger this bug.
Assignee | ||
Comment 9•2 years ago
|
||
(In reply to Timothy Nikkel (:tnikkel) from comment #7)
Feels like it would be more fool proof to have layout/gfx/core code do it to me, but I'm open to other thoughts/info.
We don't do it super-generally because the tab switcher relies on manually managing activeness, but we could find a way of doing this like bug 1847584 or so...
Comment 10•2 years ago
|
||
Sure for activeness, but it seems like it shouldn't be hard for the content process to know if it's associated compositor is paused (which is the thing more directly causing this bug, throttled refresh drivers/activeness are related but not the cause, a throttled refresh driver whose compositor is not paused won't experience this bug AFAIK), but I don't know those pipes very well.
Failing that maybe we could add another patch to SharedSurfacesAnimation::SetCurrentFrame to skip sending the resource update if nsRefreshDriver::IsWaitingForPaint.
Assignee | ||
Comment 11•2 years ago
|
||
For that, opt in tabbrowser and the shopping sidebar to manual
activeness management.
Updated•2 years ago
|
Assignee | ||
Comment 12•2 years ago
|
||
Can you confirm that D198942 fixes the issue for you? Top level window activeness is always "is the compositor paused", so it should.
Comment 13•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #12)
Can you confirm that D198942 fixes the issue for you? Top level window activeness is always "is the compositor paused", so it should.
Sorry, it did not fix the issue for me.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 14•2 years ago
|
||
Okay, latest version fixes the issue for me on Windows (I can't see the issue on Linux because we don't get vsync for the minimized window at all afaict). Can you check on mac?
Assignee | ||
Comment 16•2 years ago
|
||
I want to restrict a bit activeness setting (in particular, making sure
that this is only explicitly set for top levels, and in the parent
process).
This holds, in practice, except for these tests.
Ideally these tests should be ported to browser mochitests or so, but
that seems like a fair amount of work the way these are set up, and
these tests create an otherwise impossible situation that I want to
prevent (tab being active, one child iframe being active, and another
inactive).
I filed bug 1876117 for this.
Comment 17•2 years ago
|
||
Comment 18•2 years ago
|
||
bugherder |
Comment 19•2 years ago
|
||
Comment 20•2 years ago
|
||
Backed out for causing multiple failures in test_suspend_media_by_inactive_docshell.html
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | dom/media/test/test_suspend_media_by_inactive_docshell.html | Test timed out. -
And possibly this: https://treeherder.mozilla.org/logviewer?job_id=446271413&repo=autoland
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Comment 21•2 years ago
|
||
Comment 22•2 years ago
|
||
Comment 23•2 years ago
|
||
The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox123
towontfix
.
For more information, please visit BugBot documentation.
Comment 24•2 years ago
|
||
Assignee | ||
Comment 25•2 years ago
|
||
The patch that landed is test-only, but this is complex enough to be risky to uplift.
Comment 26•2 years ago
|
||
Comment 27•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/22c6ddd752f4
https://hg.mozilla.org/mozilla-central/rev/039742954901
https://hg.mozilla.org/mozilla-central/rev/f3d1619b2e33
https://hg.mozilla.org/mozilla-central/rev/e792abe83b59
https://hg.mozilla.org/mozilla-central/rev/87220c621617
Comment 28•1 years ago
|
||
(In reply to Timothy Nikkel (:tnikkel) from comment #3)
The animated image is in a remote iframe uri moz-extension://6c35841f-7382-4b8f-9311-f838e4f0bc24/sidebar.html and it is in a content process. So I would guess that it's compositor does not get paused (like content tabs) but its refresh driver does not get throttled (unlike content tabs) so both fixes we did for this problem miss this case.
Do you know how I can create an iframe like this in a browser chrome test? I have a browser chrome test for the other two cases that we fixed, but I'm not sure how to create an iframe to reproduce this in a test.
Assignee | ||
Comment 29•1 years ago
|
||
If you have an actual browser test, probably something like this?
Description
•