Closed Bug 1875100 Opened 2 years ago Closed 2 years ago

RAM usage grows too much on minimized browser window with sidebar panel containing APNG background

Categories

(Core :: Graphics: ImageLib, defect, P3)

Desktop
Windows 11
defect

Tracking

()

RESOLVED FIXED
124 Branch
Tracking Status
firefox123 --- wontfix
firefox124 --- fixed

People

(Reporter: yuki, Assigned: emilio)

References

(Regressed 1 open bug)

Details

Attachments

(3 files)

Attached file Testcase XPI

Steps to reproduce

  1. Run Firefox on Windows.
  2. Go to about:debugging and load the attached testcase XPI as a temporary addon.
  3. Ensure that the sidebar panel of the testcase addon is visible.
  4. Go to about:processes and memorize the PID of the "Extensions" process.
  5. Hit Ctrl-Shift-ESC to open Task Manager of Windows.
  6. Switch to "Details" panel.
  7. Right-click on the header row and turn the "Working Set" column visible.
  8. See the process row of the PID memorized at the step 4.
  9. 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

Thanks for reporting. This sounds similar to an issue we were dealing with last year, perhaps there is another case that wasn't fixed.

See Also: → 1839109
See Also: → 1830753

I can reproduce on macOS.

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.

Options to fix:

  1. find some property in this process that mirrors the paused compositor from the parent
  2. create some property in this process that mirrors the paused compositor
  3. fix bug 1819154
See Also: → 1819154

Something like bug 1847600 but for the regular sidebar rather than the shopping sidebar would do too afaict.

See Also: → 1847600
Flags: needinfo?(emilio)

(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...

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.

(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.

(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...

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.

For that, opt in tabbrowser and the shopping sidebar to manual
activeness management.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Can you confirm that D198942 fixes the issue for you? Top level window activeness is always "is the compositor paused", so it should.

Flags: needinfo?(emilio) → needinfo?(tnikkel)

(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.

Flags: needinfo?(tnikkel)
Flags: needinfo?(emilio)

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?

Flags: needinfo?(emilio) → needinfo?(tnikkel)

Latest version fixes the problem for me on mac.

Flags: needinfo?(tnikkel)

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.

See Also: → 1838350
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7dced60d446e Make gamepad mochitests don't rely on creating an impossible situation. r=cmartin
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ecd780688279 Propagate top level activeness automatically to top descendants. r=nika,tabbrowser-reviewers,mconley,extension-reviewers,robwu,geckoview-reviewers,owlish

Backed out for causing multiple failures in test_suspend_media_by_inactive_docshell.html

And possibly this: https://treeherder.mozilla.org/logviewer?job_id=446271413&repo=autoland

Flags: needinfo?(emilio)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/22c6ddd752f4 Propagate top level activeness automatically to top descendants. r=nika,tabbrowser-reviewers,mconley,extension-reviewers,robwu,geckoview-reviewers,owlish,kaya
Pushed by emilio@crisal.io: https://hg.mozilla.org/integration/autoland/rev/039742954901 Trivial lint fix. https://hg.mozilla.org/integration/autoland/rev/f3d1619b2e33 Don't call window.close() from a crashtest to fix some orange.

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 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

The patch that landed is test-only, but this is complex enough to be risky to uplift.

Severity: -- → S3
Flags: needinfo?(emilio)
Priority: -- → P3
Pushed by emilio@crisal.io: https://hg.mozilla.org/integration/autoland/rev/87220c621617 Hopefully fix windows / androids crashtest timeouts for good.
See Also: → 1879216
See Also: → 1864255

(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.

Flags: needinfo?(emilio)

If you have an actual browser test, probably something like this?

Flags: needinfo?(emilio)
Regressions: 1888649
Regressions: 1892593
Regressions: 1930425
No longer regressions: 1930425
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: