High blob memory usage and lags
Categories
(Core :: DOM: File, defect, P3)
Tracking
()
People
(Reporter: julienw, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [MemShrink])
Attachments
(4 files)
Basic information
After a few days of running, my Firefox instance takes a lot of memory and feels laggy.
Steps to Reproduce:
This is difficult to come up with steps to reproduce. What I know is that this is common that my Firefox instance runs during a few days. Because I use nightly, generally I restart Firefox just to update it.
For example the current build I use is 20200223214228, so likely last time I started this instance of Firefox is Feb 23 (we are Mar 3).
Not only this is kept running but also it survived a lot of suspend/resume cycles.
Here are the main websites I use:
- github
- slack
- riot
- gmail
- other google docs
- deezer
- lemonde
- duckduckgo
- bugzilla
I also use some extensions, most notably ublock origin and nocoin.
I have 1600 tabs but obviously they're not all loaded.
It's common I start devtools on one of these tabs just to test stuff.
More information
I attached the anonymized result of about:memory.
What will strike you is the amount of heap-unclassified
in the main process. I think it would be nice to understand where this could come from so that we could classify this better.
I also took a memory snapshot from the devtools' memory tool, but it's 80MB and probably contains PII so I didn't want to attach it here directly. But I can share it with some individuals if you want.
Profile URL: https://perfht.ml/2uPiAo5
I took this when typing some text in this text box in bugzilla.
I kept only the interesting tracks. Especially we see:
- the main process is very busy doing GC all the time, which is kind of expected.
- one content process shows the interaction with this page
- another content process shows a big GC and could free up some memory
- the webextension process shows a big GC too (I just disabled an addon right before, maybe that's the reason)
Basic systems configuration:
OS version: Debian stable
GPU model: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
Number of cores: 2 cores, 4 if we count HT.
Amount of memory (RAM): 16 GB
Reporter | ||
Comment 1•5 years ago
|
||
For reference, here is memory usage measurements right after restarting with latest nightly.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 2•5 years ago
|
||
Eric, what should we do with this report? While I'm interested in Julien's issue and any root cause we can find, I'm particularly interested in this bug getting out of Core: General or having a priority assigned to it :)
Comment 3•5 years ago
|
||
The parent process has a ton of heap-unclassified:
7,253.26 MB (100.0%) -- explicit
├──5,732.10 MB (79.03%) ── heap-unclassified
There's a pretty crazy amount of blob storage going on in the content process:
1,838.48 MB (100.0%) -- explicit
├──1,418.91 MB (77.18%) -- dom
│ ├──1,418.75 MB (77.17%) ── memory-file-data/string [11350]
....
11,350 (100.0%) -- file-blob-urls
└──11,350 (100.0%) ── owner(<anonymized>)/<anonymized-stack><anonymized-url> [11350]
My best guess is we're leaking/retaining blobs, so vaguely this is dom related, but devtools has been known to cause leaks like this so that could be related. On the other hand, it could just be a website going crazy with createObjectURL
and not performing the corresponding revokeObjectURL
Reporter | ||
Comment 4•5 years ago
|
||
I 'm sorry I didn't keep an unanonymized dump, but I'll make sure to look at the file-blob-urls line next time it happens (which is quite frequent).
Reporter | ||
Comment 5•5 years ago
|
||
Ah the Blob thing might be Deezer; I actually know that they create blob URLs in Firefox without revoking, because it was done as an "experimental" hack to make it work in Firefox. Without it we had to still use Flash. I just asked them if they still do it.
Comment 6•5 years ago
|
||
OK I'm going to mark this as P3 to get the triage nag bot off my back but let's re-evaluate and/or move to a better component if/when we learn more.
Reporter | ||
Comment 7•5 years ago
|
||
Just to make it clear, from comment 3, do we have 2 separate problems, or is that linked?
Reporter | ||
Comment 8•5 years ago
|
||
Yeah, the blob thing is probably deezer.com.
Eric, does that leak memory in the content or the parent process?
Reporter | ||
Comment 9•5 years ago
|
||
Closing the tab freed the blob URLs.
Comment 10•5 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #8)
Created attachment 9134409 [details]
screenshot of about:memoryYeah, the blob thing is probably deezer.com.
Eric, does that leak memory in the content or the parent process?
If I recall correctly the memory is shared, so both. Tearing down the tab that retains the blobs would allow them to be freed.
Reporter | ||
Comment 11•5 years ago
|
||
I had another look today, after listening to music on deezer.com a lot in the past days.
I definitely see all blob usage coming from there (about 2G in my current usage).
I don't see the heap-unclassified bits anymore, instead I see ~2G of memory-file-data/stream, which seems to relate to the blob objects. By chance could the way we report blobs here have changed? Otherwise this is a different issue.
Closing the deezer tab freed this memory, I'd say after about 1 min.
So I think the issue with Deezer is a site issue instead of a Firefox issue. Still our users could blame Firefox for the problem....
Reporter | ||
Comment 12•5 years ago
|
||
Here is a new one, this time without any blob from deezer, but still a huge line of unclassified heap.
This time I kept a non-anonymized version of it locally, in case I need to look at it.
Comment 13•5 years ago
|
||
baku, does anything about the blobs here strike you as interesting?
mccr8, any info in the memory report that we can go on or do you think it's a site leak?
Comment 14•5 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #7)
Just to make it clear, from comment 3, do we have 2 separate problems, or is that linked?
The 2 file-blob-urls
and memory-file-data/string
signatures are linked. memory-file-data/string
is the memory signature for StringBlobImpl. These blobs can be created via: webSocket, PresentationConnection, DataChannel and new Blob([some value here])
.
The signature file-blob-urls
is from file-based Blobs, such as TemporaryBlobImpl (for more than 1mb XHR/fetch/webSocket blob responses) and FileBlobImpl (from a <input type=file> or other FilePicker operations).
Comment 15•4 years ago
|
||
Sorry I didn't look at this earlier. I don't really have anything to add, except to say that if you can reliably see the high heap-unclassified value, you can run Nightly with DMD=1 and possibly get some useful information about what the heap-unclassified is by running dmd.py on the DMD log you can get in about:memory.
Updated•4 years ago
|
Comment 16•4 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #5)
Without it we had to still use Flash. I just asked them if they still do it.
Did they respond? There are mitigations possible, but other than spilling the Blobs to disk, they're visible to content and could result in breakage. (And a naive fix that makes deezer work right could break more complicate usages.)
So I think the issue with Deezer is a site issue instead of a Firefox issue. Still our users could blame Firefox for the problem....
Indeed. Blob URLs are a real footgun. This seems like a case where we'd want about:performance to surface the site's memory/disk usage and possibly display an infobar similar to how we'd tell the user if the site was making the page unresponsive through script usage.
Reporter | ||
Comment 17•4 years ago
|
||
hey, sorry for the slow reply, I was afk for a week :-)
(In reply to Andrew Sutherland [:asuth] (he/him) from comment #16)
(In reply to Julien Wajsberg [:julienw] from comment #5)
Without it we had to still use Flash. I just asked them if they still do it.
Did they respond? There are mitigations possible, but other than spilling the Blobs to disk, they're visible to content and could result in breakage. (And a naive fix that makes deezer work right could break more complicate usages.)
No I didn't get any answer from them. Maybe we should use the more official mailing list (I believe we have one with them).
Also to make it clear, the issue with Deezer was a red herring for my bigger "heap-unclassified" problem. The report in comment 12 has this without any blob from Deezer.
But now I think this is very similar to other bugs we have about the devtools so this might be it.
Comment 18•3 years ago
|
||
This bug seems to be related to bug 1591722
(I don't think I am able to edit the "See Also" section.)
Comment 19•3 years ago
|
||
It seems clear that the Deezer part of this is just a dupe of bug 1591722.
(In reply to Andrew McCreight [:mccr8] from comment #15)
Sorry I didn't look at this earlier. I don't really have anything to add, except to say that if you can reliably see the high heap-unclassified value, you can run Nightly with DMD=1 and possibly get some useful information about what the heap-unclassified is by running dmd.py on the DMD log you can get in about:memory.
Julien, did you ever try Andrew's suggestion? Is this still happening (without Deezer) ?
Reporter | ||
Comment 20•3 years ago
|
||
I haven't seen this much recently, but I also now have a better computer with much more memory and much better CPU. Also a lot less tabs on this new computer now. My about:memory doesn't seem to show anything weird right now (this instance runs for ~3 days).
I'd be fine with closing the issue for now, I can reopen if I still see this later.
Updated•3 years ago
|
Updated•10 days ago
|
Description
•