Closed Bug 1691136 Opened 5 years ago Closed 4 years ago

Enormous memory leak - >60GB on MacOS

Categories

(Core :: Performance: General, defect, P1)

Firefox 85
Unspecified
macOS
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: chelseapmcmahon, Assigned: haik)

References

Details

(Whiteboard: [mac:stability])

Attachments

(1 file)

371.96 KB, application/x-gzip
Details
Attached file memory-report.json.gz —

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0

Steps to reproduce:

Has 20 tabs open, was listening to YouTube

Actual results:

Got a pop up saying system ran out of memory, saw it was about 64GB. This has happened about 15 times in the past week since I used Firefox

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

Component: Untriaged → Widget: Cocoa
Product: Firefox → Core
Component: Widget: Cocoa → Performance

Nothing in the memory report stands out. Each of the processes have a memory usage under 300MB, and there aren't that many. Maybe try again to get a memory report when the memory is high? As best watch the activity monitor and grab a report earlier.

As we have seen recently processes that consume a lot of memory might cause the code that collects the memory as reported by memory reporters to get aborted. As such the memory report would miss the appropriate process.

As such it would be better when you would create a gecko profile. Instructions can be found here:
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler

Flags: needinfo?(chelseapmcmahon)

Could this be related to unreported memory from WR?

Flags: needinfo?(mstange.moz)

Hi! Here is a link to the upload from the profiler i just did - https://www.dropbox.com/s/y32ym62cem281tm/Firefox%202021-02-25%2015.22%20profile.json.gz?dl=0

My computer's memory usage in Firefox went from 1GB to 30+GB (via Activity Monitor) and crashes. Not sure why - hope this report reflects what's going on. I notice that if I quit the app sometimes the memory is ok for a day or so but inevitably climbs up again.

Flags: needinfo?(chelseapmcmahon)

(In reply to Bas Schouten (:bas.schouten) from comment #4)

Could this be related to unreported memory from WR?

What is WR?

Unreported memory would still show up as explicit memory in the memory report. But accounding to comment 1, this memory report doesn't have that much explicit memory.
I think this is some other kind of memory. Maybe we're leaking some GPU resource. We have encountered something like this at some point in the past, when we forgot to destroy framebuffers, in bug 1578310.

But if it were framebuffers, we would see this problem on all machines. There's probably something driver-specific here.

Flags: needinfo?(mstange.moz)

Could you attach your about:support to this bug?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(chelseapmcmahon)

I looked at the profile; the SurfacePool usage seems normal (between 70 and 110 IOSurfaces in the pool).

xel, can you reproduce this in a fresh Firefox profile in Firefox Nightly? Also, what model of Mac do you have? (Menubar Apple -> "About This Mac")
Have you been able to find any particular action that causes memory to increase extra quickly? Maybe scrolling, resizing, opening new windows, things like that.

Ok, I've been going to about:memory and doing "Minimize memory usage" every time it gets high on the Activity Monitor just so I can sustain browsing without a crash.

According to Activity Monitor:
Memory starts at 1.96 GB and ended at 32GB.
I was watching a youtube video and checking my email.

Running MacOS Catalina version 10.15.7
Macbook Air, 13 inch, Early 2015
Processor is 2.2 GHz Dual-Core Intel Core i7
Memory 8 GB 1600 MHz DDR3

At first I thought it was just YouTube but I noticed it does it no matter what I'm doing eventually. Doesn't seem to be correlated to any specific activity.

Here is the profile I just did: https://www.dropbox.com/s/l5s38kitvyo7giy/Firefox%202021-02-25%2016.16%20profile.json.gz?dl=0

It's a huge profile and uploading it seems to not really work for me. I had a quick look and sadly it doesn't contain any profiling of JS memory allocations. Reporter did you choose the Firefox Platform settings of the profiler? Maybe specifically select Custom and check that related checkbox is ticked.

Markus, the Renderer seems to be kinda busy here in MessagePumpDefault::Run:Wait. Anything you have seen so far?

Flags: needinfo?(mstange.moz)
Flags: needinfo?(chelseapmcmahon)

There are lots of addons, could you try disabling them?

And could you perhaps create a performance profile as soon as you start to see memory usage go up?

In the memory report, for the parent process I see 353.51 MB of explicit memory and 2,503.11 MB of shmem-mapped. So maybe we're leaking shared memory.
There's nothing useful in the profile.

Chelsea, when you see the high memory usage, how many "ports" does the Firefox process use? You can see it in Activity Monitor in the Ports column.

Flags: needinfo?(mstange.moz)
Whiteboard: [mac:stability]

I don't know if it helps, but I've been having the problem also and managed to capture a sample of the process before the system ran out of memory.

https://www.dropbox.com/s/3b1wy4w62q4jzav/Sample%20of%20FirefoxCP%20Web%20Content.txt?dl=0

The bits I'm aware of are:

  • Firefox did not appear to be having any form of a slow memory leak. The system rapidly went from "fine" to the FirefoxCP Web Content process having consumed > 80GB of memory. This change happend in just a few minutes.
  • The FirefoxCP Web Content process was consuming exactly 100% CPU usage (ie: one of the 6 cores completely consumed) while it was chewing up memory. It was clearly wedged in a tight spinning loop of some kind.
  • I have few addons installed, just 1Password and DuckDuckGo Privacy Essentials
  • I was running the latest Firefox at the time

Hopefully this helps.

James the activity monitor sample shows indeed 53GB of memory usage for the web content process, but there is no information in the data to what it actually belongs to. Do you have by any chance xcode installed on your machine? The Instruments app could be used to measure memory allocations.

(In reply to james.andres from comment #16)

  • Firefox did not appear to be having any form of a slow memory leak. The system rapidly went from "fine" to the FirefoxCP Web Content process having consumed > 80GB of memory. This change happend in just a few minutes.

Does it happen on a specific website in some kind of reproducible manner? It would be good to nail that down for a test case that could be used by ourselves.

  • The FirefoxCP Web Content process was consuming exactly 100% CPU usage (ie: one of the 6 cores completely consumed) while it was chewing up memory. It was clearly wedged in a tight spinning loop of some kind.

You could install my https://github.com/whimboo/perfchaser extension to keep an eye out for memory usage and CPU load. It would be good to know which threads consume the most CPU time. The extension can show that to you when the Threads panel is selected.

If you have the chance to create a performance profile at this time it would give even further information (try to select custom settings and enabling JS allocations: https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem

  • I have few addons installed, just 1Password and DuckDuckGo Privacy Essentials

If it's reproducible try to disable all or some addons. Maybe that makes a difference.

This sounds like an S1 level issue. Could someone from the virtual MacOS team take a look?

Severity: -- → S1
Flags: needinfo?(mstange.moz)
OS: Unspecified → macOS
Priority: -- → P3

I saw something like this once and ran into bug 1686795

Assignee: nobody → haftandilian
Priority: P3 → P1

I'm looking into this for now.

Flags: needinfo?(mstange.moz)

Hi Haik, did you have chance to look at this?

Flags: needinfo?(haftandilian)

I haven't been able to reproduce this. I've tested on an M1 MacBook, 2018 MacBook Pro, and a 2018 MacBook Air with profiles with addons installed. I have access to a 2015 MacBook Air I will also test on.

I have seen content process memory spike to over 1GB, but not in the range of the leak reported.

If anyone hitting the leak has a reproducible test case, or more examples of sites visited and addons installed, that would be much appreciated.

Given that this is proving hard to reproduce, I'm going to lower the severity to S2. I do not think this affects a large percentage of users at this time.

Flags: needinfo?(haftandilian)
Severity: S1 → S2
Priority: P1 → --
Priority: -- → P1

We received another similar report on Twitter recently: https://twitter.com/y80481629/status/1453305283317354496

macOS 12.0.1 (21A559)
Firefox 93.0 (64-bit)
MacBook Pro (16-inch, 2021)

Since they are running macOS 12 that's probably bug 1735345, although perhaps might be related?

@Timothy Thanks, Tim. I was looking for the Monterey version but couldn't find it. I'll move the report to bug 1735345.

This is being reported in the press, but it also affects some of Apple's own apps: https://www.macrumors.com/2021/11/01/macos-monterey-memory-leak-user-reports/

See Also: → 1693382

Redirect a needinfo that is pending on an inactive user to the triage owner.
:fdoty, since the bug has high priority and high severity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(chelseapmcmahon) → needinfo?(fdoty)

It doesn't look like there's enough to go on here, unfortunately.

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(fdoty)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: