Closed Bug 1678563 Opened 4 years ago Closed 3 years ago

Memory leak on Youtube Live Chat

Categories

(Core :: JavaScript Engine: JIT, defect, P2)

Firefox 83
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: oscar.silvestrexx, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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

Steps to reproduce:

Tested on Firefox Release 83 and Firefox Nightly 85

  1. https://www.youtube.com/watch?v=_HYTbLF_5eI
  2. Open Live Chat
  3. Memory usage increases fast without limit

Actual results:

Memory usage shot up to 4GB and used all of my RAM

Expected results:

Memory usage should've remained sane

Summary: JS WARP meemory leak on Youtube Live Chat → JS WARP memory leak on Youtube Live Chat
Summary: JS WARP memory leak on Youtube Live Chat → Memory leak on Youtube Live Chat

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → JavaScript Engine: JIT
Product: Firefox → Core
See Also: → 1533815
See Also: 15338151509656

The severity field is not set for this bug.
:sdetar, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(sdetar)

Steve, do you think you help me set the severity for this bug?

Flags: needinfo?(sdetar) → needinfo?(sphink)

I attempted to reproduce and was unable to. I tried clicking on the paid/"super" comments but still got nothing. Disabling my adblocker also did not expose the high memory usage.

Based on https://firefox-source-docs.mozilla.org/bug-mgmt/guides/severity.html I'm picking S3 for now.

oscar.silvestrexx : it would be useful to see an about:memory report (go to about:memory in the url bar, choose "Measure and save..." with or without "anonymize" checked).

Severity: -- → S3
Flags: needinfo?(sphink)

I'll note that I am not using WebRender, since it was causing problems on my system. I mention this because of bug 1509656 (which may or may not be related).

Oscar, are you still able to reproduce this issue?

Could you capture a profile by typing about:memory in the address bar, then in the section "Save memory reports", check "anonymize" and the click "Measure and save …" ? Then, attach the file to this bug, such that we can investigate which part of the browser consumes too much memory.

Flags: needinfo?(oscar.silvestrexx)

Can't reproduce the memory leak anymore on Firefox Nightly 86.0a1.

Flags: needinfo?(oscar.silvestrexx)

(In reply to oscar.silvestrexx from comment #7)

Can't reproduce the memory leak anymore on Firefox Nightly 86.0a1.

Thanks for testing, are you still able to reproduce it with older version?
The indirect question being do we still have users on release which are suffering from the same issue, in which case we need to figure out what fixed the issue.

Priority: -- → P2

I can still reproduce this on current nightly. Only happens if the chat is visible, if hidden withing the first few seconds after loading the page then the leak doesn't happen. If left open, the tab either crashes, or more frequently, the page turns black and starts flickering and the whole window becomes almost completely unresponsive. Getting it to crash or become unresponsive is easier to reproduce on low memory devices, takes about 10 minutes on a 2GB device, can take up to 3 hours on a 8GB device.

I can reproduce this on firefox 86.0, but I can take a day until it becomes an issue (16GB machine).
I suppose the leak depends on the activity in the chat window (1,244,758,632 B (31.08%) ── orphan-nodes may be chat messages). You can use this url and keep it running in the background and mute it to reproduce it I think: https://www.youtube.com/watch?v=5qap5aO4i9A

I blocked the live-chat with ublock by blacklisting https://www.youtube.com/live_chat, will see if that helps

The report is anonymized, but here is the relevant snippet. I disabled my youtube plugins for this report but not ublock, since this is just too painful for a whole day.

4,005,298,160 B (100.0%) -- explicit
├──2,876,446,440 B (71.82%) -- window-objects
│ ├──2,662,764,072 B (66.48%) -- top(https://www.youtube.com/watch?v=5qap5aO4i9A, id=156)
│ │ ├──2,502,642,088 B (62.48%) -- active
│ │ │ ├──2,443,665,608 B (61.01%) -- window(https://www.youtube.com/live_chat?continuation=0ofMyANxGlhDaWtxSndvWVZVTlRTalJuYTFaRE5rNXlka2xKT0hWdGVuUm1NRTkzRWdzMWNXRndOV0ZQTkdrNVFSb1Q2cWpkdVFFTkNnczFjV0Z3TldGUE5HazVRU0FCMAGCAQIIBIgBAaAB2ffdkvWn8AKyAQA%253D)
│ │ │ │ ├──1,253,959,896 B (31.31%) -- dom
│ │ │ │ │ ├──1,244,758,632 B (31.08%) ── orphan-nodes
│ │ │ │ │ ├──────6,998,800 B (00.17%) ── element-nodes
│ │ │ │ │ ├──────1,759,440 B (00.04%) ── text-nodes
│ │ │ │ │ ├────────230,768 B (00.01%) ── comment-nodes
│ │ │ │ │ ├────────174,080 B (00.00%) ── other
│ │ │ │ │ ├─────────36,000 B (00.00%) ── performance/resource-entries
│ │ │ │ │ └──────────2,176 B (00.00%) ── media-query-lists
│ │ │ │ ├──1,183,018,112 B (29.54%) -- js-realm(https://www.youtube.com/live_chat?continuation=0ofMyANxGlhDaWtxSndvWVZVTlRTalJuYTFaRE5rNXlka2xKT0hWdGVuUm1NRTkzRWdzMWNXRndOV0ZQTkdrNVFSb1Q2cWpkdVFFTkNnczFjV0Z3TldGUE5HazVRU0FCMAGCAQIIBIgBAaAB2ffdkvWn8AKyAQA%253D, about:blank)
│ │ │ │ │ ├──1,178,550,704 B (29.42%) -- classes
│ │ │ │ │ │ ├────465,100,800 B (11.61%) -- class(Object)/objects
│ │ │ │ │ │ │ ├──322,264,384 B (08.05%) ── gc-heap
│ │ │ │ │ │ │ └──142,836,416 B (03.57%) -- malloc-heap
│ │ │ │ │ │ │ ├──140,723,008 B (03.51%) ── slots
│ │ │ │ │ │ │ └────2,113,408 B (00.05%) ── elements/normal
│ │ │ │ │ │ ├────166,092,768 B (04.15%) -- class(HTMLElement)/objects
│ │ │ │ │ │ │ ├──147,635,328 B (03.69%) ── malloc-heap/slots
│ │ │ │ │ │ │ └───18,457,440 B (00.46%) ── gc-heap
│ │ │ │ │ │ ├────120,823,936 B (03.02%) -- class(Array)/objects
│ │ │ │ │ │ │ ├──119,666,096 B (02.99%) ── gc-heap
│ │ │ │ │ │ │ └────1,157,840 B (00.03%) -- malloc-heap
│ │ │ │ │ │ │ ├──1,156,464 B (00.03%) ── elements/normal
│ │ │ │ │ │ │ └──────1,376 B (00.00%) ── slots
│ │ │ │ │ │ ├─────95,804,304 B (02.39%) -- class(WeakMap)/objects
│ │ │ │ │ │ │ ├──92,728,800 B (02.32%) ── malloc-heap/misc
│ │ │ │ │ │ │ └───3,075,504 B (00.08%) ── gc-heap
│ │ │ │ │ │ ├─────78,973,536 B (01.97%) -- class(Function)/objects
│ │ │ │ │ │ │ ├──78,873,632 B (01.97%) ── gc-heap
│ │ │ │ │ │ │ └──────99,904 B (00.00%) ── malloc-heap/slots
│ │ │ │ │ │ ├─────71,995,968 B (01.80%) -- class(Call)/objects
│ │ │ │ │ │ │ ├──71,954,816 B (01.80%) ── gc-heap
│ │ │ │ │ │ │ └──────41,152 B (00.00%) ── malloc-heap/slots
│ │ │ │ │ │ ├─────47,164,800 B (01.18%) -- class(DocumentFragment)/objects
│ │ │ │ │ │ │ ├──28,706,112 B (00.72%) ── malloc-heap/slots
│ │ │ │ │ │ │ └──18,458,688 B (00.46%) ── gc-heap
│ │ │ │ │ │ ├─────34,833,520 B (00.87%) -- class(HTMLSpanElement)/objects
│ │ │ │ │ │ │ ├──18,441,456 B (00.46%) ── gc-heap
│ │ │ │ │ │ │ └──16,392,064 B (00.41%) ── malloc-heap/slots
│ │ │ │ │ │ ├─────30,764,208 B (00.77%) -- class(HTMLDivElement)/objects
│ │ │ │ │ │ │ ├──18,455,856 B (00.46%) ── gc-heap
│ │ │ │ │ │ │ └──12,308,352 B (00.31%) ── malloc-heap/slots
│ │ │ │ │ │ ├─────18,453,216 B (00.46%) ── class(Comment)/objects/gc-heap
│ │ │ │ │ │ ├─────12,310,304 B (00.31%) -- class(Text)/objects
│ │ │ │ │ │ │ ├──12,309,600 B (00.31%) ── gc-heap
│ │ │ │ │ │ │ └─────────704 B (00.00%) ── malloc-heap/slots

I can confirm blocking https://www.youtube.com/live_chat did remove the issue

I have the same issue, watching a YouTube live stream sometimes everything becomes slow and my RAM usage shoots up. Having 32 GB of RAM my Firefox reached 10 GB for the one tab.. it's especially bad if you pop-out the chat from the YouTube page.

I can reproduce this issue with the link from comment 0, both in Firefox and in Chromium. Both browser a slowly increasing memory footprint which are raising at the same rate in both browsers.

Thus, this issue would most likely be an issue in the way the live-chat is implemented, instead of being specifically a Firefox issue.

Karl, would you know how to contact Youtube developer to forward this issue?

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(kdubost)
Resolution: --- → WORKSFORME

(In reply to oscar.silvestrexx from comment #0)

Memory usage shot up to 4GB and used all of my RAM

After 30 minutes running in the background, I only noticed around 150MB associated with the live-chat.
Do you see a faster memory increase?

Flags: needinfo?(oscar.silvestrexx)

Nicolas, yes there is a mailing list for it, if you want to contact them. I will send you the reference in private.

Flags: needinfo?(kdubost)

(In reply to Nicolas B. Pierron [:nbp] from comment #13)

Thus, this issue would most likely be an issue in the way the live-chat is implemented, instead of being specifically a Firefox issue.

I just transferred this issue to a mailing list which should reach some Youtube employee.

Hello! As of today I can still experience this issue in Firefox and it seems really related to the live chat box on YouTube. If the live chat runs for 1 or 2 hours I have the browser taking over 9gb of system RAM and the live stream becomes very unstable and starts hanging (as if it was caching the video).

Are there any updates on whether this issue has been confirmed by Google and if a solution is being worked on?

Thank you.

I use this script with TamperMonkey to fix it temporarily until an official fix comes. It works perfectly in fixing the issue.

https://greasyfork.org/en/scripts/422206-workaround-for-youtube-chat-memory-leaks

(In reply to famicom4 from comment #17)

Hello! As of today I can still experience this issue in Firefox […]

I forwarded your inquiry, to know what is the status of Youtube's Live Chat on this issue.

(In reply to oscar.silvestrexx from comment #18)

I use this script with TamperMonkey to fix it temporarily until an official fix comes. It works perfectly in fixing the issue.

https://greasyfork.org/en/scripts/422206-workaround-for-youtube-chat-memory-leaks

Thanks a lot!

This work-around contains a comment which details the issue. If this is still the same issue as a year ago, this would probably help the employees who are responsible for this code.

(In reply to oscar.silvestrexx from comment #18)

I use this script with TamperMonkey to fix it temporarily until an official fix comes. It works perfectly in fixing the issue.

https://greasyfork.org/en/scripts/422206-workaround-for-youtube-chat-memory-leaks

Thank you so much for the information! I'll be sure to try this work-around for the time being.

(In reply to Nicolas B. Pierron [:nbp] from comment #19)

(In reply to famicom4 from comment #17)

Hello! As of today I can still experience this issue in Firefox […]

I forwarded your inquiry, to know what is the status of Youtube's Live Chat on this issue.

Thank you! I'm actually surprised they haven't fixed that yet if we consider YouTube has a huge user-base. But anyway, I'll be looking forward to an update on this issue eventually.

Just to report that the issue is still present in latest FF version and the script suggested above didn't help much when using a laptop with 4gb RAM and an i3-3217U. Then I switched to Chrome and no issues there. The RAM used by the browser didn't go above 600mb.

Would this really be a YouTube live chat bug and not a Firefox one?

The issue is present on both Firefox and Chrome for streams with very fast live chat.

Flags: needinfo?(oscar.silvestrexx)

(In reply to Nicolas B. Pierron [:nbp] from comment #19)

(In reply to famicom4 from comment #17)

Hello! As of today I can still experience this issue in Firefox […]

I forwarded your inquiry, to know what is the status of Youtube's Live Chat on this issue.

I have not got any additional feedback since my last message.
I will post if I get any in the future.

See Also: → 1825686
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: