Closed Bug 1549181 Opened 5 years ago Closed 2 years ago

GPU process has a lot of private bytes with hardware decoding enabled

Categories

(Core :: Graphics, defect, P3)

68 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: zao, Unassigned)

References

Details

(Keywords: regression)

Crash Data

Attachments

(1 file)

Attached file memory-report.json.gz

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

Steps to reproduce:

Firefox process has a whole lot of Rust documentation tabs, a twitch.tv, a large (24 MiB) <pre>-full debug output page, and some YouTube tabs, all in all maybe 60-80 tabs.

This is build 20190503215639, 64-bit Windows 10 1903.

Actual results:

Process Explorer shows one Firefox process having 18 gigabytes of "private bytes", about:memory attributes this to the GPU process.

General browsing experience and system performance is sluggish, some windows/tabs take a noticeable time to get ready when opening them.

Memory report from about:memory attached.

Component: Untriaged → Graphics
Product: Firefox → Core

I've seen several reports on IRC of the same thing.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Reportedly disabling hardware acceleration fixes it. It might also be related to Windows 10 1903 update.

The memory leak happens with videos. It's easy to reproduce for example by opening and closing youtube videos. Disabling media.hardware-video-decoding.enabled works around it.

Note that the reported has a lot of tabs, but other reports show the same issue with 1-2 tabs open. As long as YouTube or Twitch are involved, memory usage seems to go through the roof.

2 users had NVIDIA cards with latest (WDDM 2.6 drivers). 1 user had an Intel laptop but also had the very latest drivers with WDDM 2.6 support.

I realized only now this report only mentioned the Nightly branch. Latest stable version 66.0.4 is also affected.

Since this is fixed by media.hardware-video-decoding.enabled moving to Media.

Component: Graphics → Audio/Video: Playback
Flags: needinfo?(drno)

Jean-Yves do you have any idea what recent changes could cause such memory leaks?

Flags: needinfo?(drno) → needinfo?(jyavenard)
Priority: -- → P2
Summary: GPU process has a lot of private bytes → GPU process has a lot of private bytes with hardware decoding enabled

I do not have an explanation. There's been no changes on the HW decoder of late.

The only thing I can think of is the switch to WebRender for most.

If you set gfx.webrender.force-disabled to true, does it make a difference to the amount of memory you're seeing?

Flags: needinfo?(jyavenard) → needinfo?(zao)

I can check, but for me in my regular installation and profile it doesn't always manifest clearly and tends to take half a week to somehow end up in the state where it has consumed 11+ gigs.

If Janne H has a more reliable reproduction setup, maybe he can try it out?

I should add that I run my desktop in 10 bit-per-channel on the primary monitor and 8 bit-per-channel on the secondary monitor, and have also told the NV control panel to do video in 0-255 full-scale. Otherwise the machine is reasonably freshly installed with 1903 so not too much in the way of junk.

On my system notable weirdo DLLs present in the Firefox process are NVidia's Ansel Camera thing, and RTSS which I use for clamping present rate in games. Ansel gets loaded and unloaded a lot when I refresh a video tab. Seems like an unlikely culprit however if the problem has been observed on Intel devices as well.

I don't notice the setting to really have any effect on the matter.

Note that I have never gotten my GPU memory usage as high as what the OP reports. I tend to restart my browser every now and then and don't keep that many tabs open. I only noticed that memory use increased with every video played and the browser didn't restore the memory back without killing the process. For example just playing a dozen videos for about a second each made the process consume over a gigabyte of memory with only about:blank open. And about:memory showed the memory was in the private bytes of the GPU process.

I tested the effect of the setting with a laptop that has Intel graphics and with my desktop that has Nvidia. Both showed the same behavior.

I changed gfx.webrender.force-disabled to true and restarted Firefox at the point of comment 9.

GPU process is now at 7.4 GiB private bytes, primary use being videos and some private browsing.

Flags: needinfo?(zao)

(In reply to Lars Viklund from comment #11)

I changed gfx.webrender.force-disabled to true and restarted Firefox at the point of comment 9.

GPU process is now at 7.4 GiB private bytes, primary use being videos and some private browsing.

When you right click on a video in YouTube, and select "statis for nerds". What do you see?

Thanks

Flags: needinfo?(zao)

I don't have that leaked session running, but here's from a build I made last night for the video at https://www.youtube.com/watch?v=-U0AFQbfv88:

Video ID / sCPN
-U0AFQbfv88 / 7SSG 3RNN 0PGP
Viewport / Frames
793x446*1.50 / 0 dropped of 327
Current / Optimal Res
1920x1080@25 / 1920x1080@25
Volume / Normalized
100% / 60% (content loudness 4.4dB)
Codecs
vp09.00.51.08.01.01.01.01 (248) / opus (251)
Color
bt709 / bt709
Host
r6---sn-5go7yne6
Connection Speed
42317 Kbps
Network Activity
0 KB
Buffer Health
41.90 s
Mystery Text
s:4 t:13.06 b:0.000-54.960 P
Flags: needinfo?(zao)

I can add that closing down one of these megaleaked instances also free up around 3 GiB of video memory so it's not just hogging RAM.
I tend to notice that Firefox has gone pear-shaped when games start chugging due to memory pressure.

I don't know if this is normal video memory usage for Firefox, of course.

I'm having the same problem as the submitter and it seems to be caused by the Windows 10 1903 update. I've updated to 1903 yesterday and this suddenly started happening without Firefox being updated (still on 67). I went to the Firefox subreddit and found this post from yesterday with at least two people with exactly the same experience.

I tried removing the nvidia drivers and reinstalling but that didn't seem to help.

See Also: → 1552722

This is likely a regression in Windows 1903. Somehow how we are handling GPU images isn't behaving like it used to.

Moving to graphics as they have more tools and know-how on how to troubleshoot this problem.

On Windows, when doing hardware vidéo decoding is performed, all is done in the GPU process: vidéo memory allocation, decoding, life cycle is managed there.

Component: Audio/Video: Playback → Graphics
Priority: P2 → P1
Crash Signature: [@ OOM | small]

For me this is fixed when installing KB4497935. To confirm I did the following:
No update -> issue is present,
Install update -> issue disappears,
Uninstall update -> issue is present once again,
Install update -> issue disappears.

Issue was reproduced by continously opening 8k60 videos and closing them again. When the issue is present private bytes keeps rising while after installing KB4497935 private bytes goes down after closing it.

With the KB update applied the GPU process seems to indeed behave well again.

firefox 73, webrender is off, windows 7, intel video.
for several hours, several tabs were opened, including with video playback. after closing all tabs, the GPU process still allocates 1500 MB of memory (working set). the working set of other Firefox processes is normal.

Priority: P1 → P3

I spent some time trying to understand this bug because it kept crashing my Windows 10 1903 system with a high end NVidia card with 8GB of VRAM. Every two days I'd run out of GPU RAM; I finally figured it out was Firefox that was grabbing the VRAM. Quitting Firefox entirely fixed it, but I didn't know to do that until I started diagnosing the problem.

My best guess is, as several folks suggested above, it's related to hardware decoding of video. I could never reliably reproduce it but looking at lots of meme videos on Reddit using the Imagus extension (which creates popups) definitely was a culprit.

I tried installing KB4497935 to fix it but that Microsoft patch said it was not appropriate for my system. Perhaps I already had a later patch.

What did fix it was upgrading from Windows 10 1903 to 2004. After a few days testing the problem seems to have gone away. Not a very satisfying answer, but possibly a helpful one for people.

The problem for Firefox is Microsoft is very conservative about rolling out Windows major updates. I've got my home system set up for full auto-updates and it never did upgrade me from 1903 to 1909. Nor did it upgrade me to 2004, although when I checked Windows Update manually it was there waiting for me to click a button to install. A lot of users may still be running 1903 even though it's mid 2020.

See also Bug 1519262 and Bug 1502798 (and probably others). More notes on this bug at https://nelsonslog.wordpress.com/2020/06/10/firefox-gpu-ram-leak/

I apologize, I spoke too soon. Windows 10 version 2004 did not solve this problem. My system just blew up while I was playing World of Warcraft (2GB of VRAM) and had Firefox open in the background with about 8 tabs. WoW complained about being out of memory. When I checked Firefox was holding on to 25 GB of VRAM. Quitting Firefox fixed it, at least for now. I feel like 2004 may have helped things, but it hasn't solved the problem entirely.

Can you still reproduce?

Flags: needinfo?(zao)
Flags: needinfo?(nelson.minar)

I haven't seen this problem manifest since my last comment about the KB update seemingly addressing it, at least not in any manner bad enough that would force me to look at resource usage.

Flags: needinfo?(zao)

Thanks for the update

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

Attachment

General

Creator:
Created:
Updated:
Size: