Open Bug 1833016 Opened 1 year ago Updated 5 months ago

Very high JS string memory usage and lots of structured-clone-holder, with lag and slowdowns

Categories

(WebExtensions :: Untriaged, defect)

Firefox 112
x86_64
Windows 11
defect

Tracking

(Performance Impact:medium)

Performance Impact medium

People

(Reporter: mozilla_bugzilla.jzh1n, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: perf:animation, perf:resource-use, perf:responsiveness)

Attachments

(3 files, 1 obsolete file)

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

Steps to reproduce:

I've been using firefox relatively normally, with a reasonable amount of tabs open (~20 at most); mostly quite simple pages (nothing fancy like youtube or anything). Recently, within maybe the past few weeks, I've noticed that firefox starts to use absolutely absurd amounts of memory (tens of gigabytes), and starts getting very choppy.

I noticed that this mainly happens when switching between tabs:

  1. When I stay on one tab for a several minutes, the memory usage appears do be much lower, but still around 5GB which I think is a bit silly
  2. As soon as I switch tabs, especially if I go through multiple tabs, the memory usage massively spikes
  3. Switching to another virtual desktop seems to have the same effect as (1), where the memory rapidly drops.

My Specs:
CPU: 17-12700H (6 p-cores + 8 e-cores/ 20 threads)
RAM: 64GB DDR5
GPU: Iris XE/RTX 3070 Ti Laptop
DISK: 1TB NvME SSD (Micron MTFDKBA1T0TFH)

Actual results:

  1. Insane memory usage - Average in the 15-25GB range, I recorded it go up to 48GB, and 51GB when recording GC info
  2. Scrolling playing up - It is delayed by several seconds from me physically scrolling, and barely moves (tens of pixels at a time)
  3. Switching tabs has a pause between me clicking and the tab actually switching
  4. The UI freezes - elements don't do hover animations, have to wait a long time for clicks to register, etc
  5. Super slow website loading - I have gigabit ethernet (have tested it), but yet websites are extremely slow to load. In one case I had to wait over 5 minutes for my email (protonmail) to load the login screen, where normally it takes seconds at most

Expected results:

Memory usage stays stable, and does not shoot stupidly high. Also, the UI should not experience massive slowdowns to the point of being unusable, especially on a highly specced machine

Attached file Memory Report from `about:memory` (obsolete) —

The Bugbug bot thinks this bug should belong to the 'Core::Performance' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Performance
Product: Firefox → Core
OS: Unspecified → Windows 11
Hardware: Unspecified → x86_64

This bug was moved into the Performance component.

:mozilla_bugzilla.jzh1n, could you make sure the following information is on this bug?

  • For slowness or high CPU usage, capture a profile with http://profiler.firefox.com/, upload it and share the link here.
  • For memory usage issues, capture a memory dump from about:memory and attach it to this bug.
  • Troubleshooting information: Go to about:support, click "Copy raw data to clipboard", paste it into a file, save it, and attach the file here.

If the requested information is already in the bug, please confirm it is recent.

Thank you.

Flags: needinfo?(mozilla_bugzilla.jzh1n)
Attached file about:support
# about:support

The GC and CC logs shouldn't be necessary at this point, and can contain a lot of private information, so it is best to avoid attaching them. (The file you attached is 72 bytes so I think it didn't upload correctly.)

The main process has 4GB of structured-clone-holder, which is quite a bit:

5,030.67 MB (100.0%) -- explicit
├──4,020.45 MB (79.92%) -- dom
│ ├──4,019.67 MB (79.90%) ── structured-clone-holder [608]

The first 5 Isolated Web Content processes I looked at had an immense amount of memory being used for JS strings, from 1GB down to 700MB.

Even the web processes that aren't using much memory total still have the majority of their memory taken up by JS strings, so it isn't a problem specific to a particular domain.

I don't see a WebExtension process which is odd. Maybe it is very bogged down and didn't produce a report.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Insane memory usage, linked with slowdowns/lag → Very high JS string memory usage and lots of structured-clone-holder, with lag and slowdowns

Bug 1833070 also involves a lot of structured-clone-holder memory, though that's a much smaller part of the issue so my guess is that it isn't related.

My guess would be that some WebExtension is causing a lot of strings to be allocated somehow, but I don't really know how. Given that the issue here is causing a lot of lags for you, the easiest way to figure out what might be at fault is probably the profiler, as described in comment 4.

See Also: → 1833070

(In reply to Andrew McCreight [:mccr8] from comment #6)

The GC and CC logs shouldn't be necessary at this point, and can contain a lot of private information, so it is best to avoid attaching them. (The file you attached is 72 bytes so I think it didn't upload correctly.)

Good to know, I'll remember for next time. Is it possible to remove them in that case? I don't see a button to do so.

I've recorded a profiler run and am uploading the updated info now

Flags: needinfo?(mozilla_bugzilla.jzh1n)

Update: I have updated the attachment, it now includes the profiler report and does not contain any GC/CC logs (so you will need to redownload it)

I'm not too familiar with WebExtensions, I assume they are just normal browser extensions? It's definitely a possibility since I do have a few installed. The only notable ones I can think of that could be doing anything significant are NoScript, UBlock Origin and maybe Dark Reader and Ghostery. I've had these extensions for a long time though, so I think that's less likely.

The Performance Impact Calculator has determined this bug's performance impact to be medium. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platforms: Windows
Impact on browser: Renders browser effectively unusable
Configuration: Rare
[x] Causes severe resource usage
[x] Affects animation smoothness

We see the profile showing severe activity in the Keeper extension process.

Component: Performance → Untriaged
Product: Core → WebExtensions
Performance Impact: --- → medium
See Also: → 1769763

Thanks everyone, it seems to be an issue relating to the Keeper Password Manager extension. I disabled it because of your comment:

(As per Bas Schouten (:bas.schouten) from comment #11)
The Performance Impact Calculator has determined this bug's performance impact to be medium. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platforms: Windows
Impact on browser: Renders browser effectively unusable
Configuration: Rare
[x] Causes severe resource usage
[x] Affects animation smoothness

We see the profile showing severe activity in the Keeper extension process.

As of a few days now, I haven't noticed any crazy performance freezes or memory usage as before. I think it definitely relates to 1769763, since they had a similar issue.

Interestingly, I had issues with Keeper, and #1769763 mentioned keeper and lastpass as well.

Update: I've noticed that I'm still having a similar issue, but not quite so badly any more.
I noticed FireFox using quite a lot of memory (A consistent 8-10GB) with a (small) amount of chugging when loading new pages. I noticed that dom/structured-clone-holder was using ~1.3GB , as well as the GPU using 2.3GB for gfx/webrender (most of it was in textures). I don't know if these are related at all, but I though I should mention it. I will also not that the Keeper extension has been disabled this entire time since my last comment two weeks ago.

Comment on attachment 9337364 [details]
memory-report-2023-06-04.json.gz

New memory report relating to latest comment

Thanks for the memory report. It does unfortunately not contain anything actionable.

Firefox 115 (currently Nightly, will be Beta in a few days) include additional information (added in bug 1769763) which would make it easier to diagnose this issue.

Would you be willing to install Firefox Beta when it reaches version 115 (next week), use it as you normally would and create a memory report for it when you encounter the issue?

Flags: needinfo?(mozilla_bugzilla.jzh1n)

Hello,

The 115 version has increased CPU usage in structured-clone-holder.
Can you confirm this is a temporary increase due to the additional debugging info added to this method?

I work at Dashlane and we noticed a latency in our product since 115.

On 115 we notice a latency: https://share.firefox.dev/442n3Pj
On 114 all seems good https://share.firefox.dev/3N5xAlN

(In reply to quadristan from comment #17)

The 115 version has increased CPU usage in structured-clone-holder.
Can you confirm this is a temporary increase due to the additional debugging info added to this method?

The patch in bug 1769763 is not intended to be temporary. Please file a new bug with the information about the regression that you are experiencing (the text here is a good start) so that it can be triaged. Core:: Performance might be a good component to start with. It will likely get lost in the shuffle otherwise. Thanks.

Flags: needinfo?(quadristan)

Thank you Andrew. I posted it there https://bugzilla.mozilla.org/show_bug.cgi?id=1838448

Flags: needinfo?(quadristan)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:rpl, since the bug doesn't have a severity set, could you please set the severity or close the bug?

For more information, please visit BugBot documentation.

Flags: needinfo?(mozilla_bugzilla.jzh1n) → needinfo?(lgreco)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: