Memory leak in foreground webworker
Categories
(Core :: JavaScript: GC, defect, P3)
Tracking
()
Performance Impact | low |
People
(Reporter: mrossman, Unassigned)
References
Details
(Keywords: perf:resource-use)
Attachments
(3 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:77.0) Gecko/20100101 Firefox/77.0
Steps to reproduce:
-
Clone the brfv5-browser project repository (I've provided the specific commit):
https://github.com/Tastenkunst/brfv5-browser/tree/d77ada73cac828a04b0ae6b0b5f219cf12f62296 -
Start a live server in the project (e.g. on port 5500)
-
Navigate to the
minimal__webworker__track_one_face.html
page on the server -
Let the demo run in the foreground for a few minutes
Actual results:
Firefox's webworker process gradually gains more and more memory (I've seen multiple gigabytes) causing the page to get slower and slower, and eventually unresponsive. I also noticed that if I switch tabs, the webworker process will start releasing memory back to acceptable levels.
In Google Chrome, the webworker does not keep consuming memory in this way, suggesting that it is a Firefox bug rather than a bug with this specific example.
Expected results:
The webworker should release unused memory while running in the foreground. Firefox should not degrade the performance of the web app.
Reporter | ||
Comment 1•4 years ago
|
||
I just reproduced this on a fresh install of Firefox Nightly as well.
Comment 2•4 years ago
|
||
Hi,
Thanks for the report. Could you please submit a memory report?
Here are the steps to create it from about:memory
- Wait until Firefox is consuming a large amount of memory
- Enter about:memory in the URL bar and press enter
- Click "Measure and save" (optionally with "anonymize" checked to hide URLs, although this will likely make it more difficult for us to figure out which site, if any, is causing the leak)
- Save the memory report somewhere
- Attach the report to this bug
Can you record a performance profile? The instructions in https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Reporting_a_Performance_Problem should work if it's usable initially and then hangs for a bit; otherwise, the steps at https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Profiling_with_the_Built-in_Profiler#Profiling_Firefox_Startup would help to profile startup itself (for "the add-on", read "the builtin profiler", see instructions for enabling that on the first page)
Also, could you please post your about:support text?
Best,
Clara
Reporter | ||
Comment 3•4 years ago
|
||
"Firefox NightlyCP Web Content" (which I presume to be the webworker, as it continued to grow in size) was using up around 2.4 GB of memory on my system when I captured this report.
Reporter | ||
Comment 4•4 years ago
|
||
Reporter | ||
Comment 5•4 years ago
|
||
Here is a performance profile capture when "Firefox NightlyCP Web Content" was using just over 2 GB of memory on my system:
Comment 6•4 years ago
|
||
Thanks for the additional attachments!
I will move this over to a component so developers can take a look over it. If is not the correct component please feel free to change it to an appropriate one.
Best regards, Clara.
Comment 7•4 years ago
|
||
mrossman, just to confirm the right component: Did you have DevTools open (it doesn't sound like it)?
Reporter | ||
Comment 8•4 years ago
|
||
I just reproduced it without DevTools open (I don't think I had it open when I captured those reports either).
Comment 9•4 years ago
|
||
Thank you. Performance is a better component then.
Comment 10•4 years ago
|
||
The memory report shows 2.2GB taken up by ArrayBuffers:
Web Content (pid 21057)
Explicit Allocations
2,458.44 MB (100.0%) -- explicit
├──2,397.48 MB (97.52%) -- workers/workers(localhost)/worker(./js/worker/setup__worker.js, 0x159e4a000)
│ ├──2,394.80 MB (97.41%) -- zone(0x1105bb000)
│ │ ├──2,393.97 MB (97.38%) -- realm(web-worker)
│ │ │ ├──2,393.63 MB (97.36%) -- classes
│ │ │ │ ├──2,388.87 MB (97.17%) -- class(ArrayBuffer)/objects
│ │ │ │ │ ├──2,248.71 MB (91.47%) ── malloc-heap/elements/normal
Moving to GC.
Comment 11•4 years ago
|
||
The severity field is not set for this bug.
:jonco, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 12•4 years ago
|
||
It's possible that this is the same issue as bug 1407691.
Updated•4 years ago
|
Updated•3 years ago
|
Description
•