Very high CPU usage and jank, after moving mouse cursor over YouTube video player or thumbnails
Categories
(Web Compatibility :: Site Reports, defect, P3)
Tracking
(platform-rel +, firefox84 affected, firefox102 affected)
People
(Reporter: timbugzilla, Assigned: denschub)
References
()
Details
(5 keywords, Whiteboard: [platform-rel-Youtube] [workaround is in comment #17])
Attachments
(8 files)
https://www.youtube.com/watch?v=UjMj1Otvo4o Open the link in a tab, play video, and choose "cinema mode" player size (larger size, generally ensures HD resolution). Video is VP9/webm. High CPU usage may be observed, with high memory usage too. High CPU usage (often maxing out a core) will definitely be observed if the mouse pointer is moved over the video repeatedly. Browser may hang or freeze. Tab switching may be very slow. Computer used had Intel i5-4670 CPU, AMD HD7790 GPU, Win10 x64 (all updates installed inc 1607 update). All drivers etc latest versions. Nightly x64 20160902 build. Profile with high CPU usage: https://cleopatra.io/#report=f9b58e11f141fa79201dfd7e991e0aa3971c5743&selection=0,109,110,111,112,113,114,1,115,116,117,118,119,120,121,122,311,123,154,312,155,313,314,315,316 Most time spent in 0xa59a4 ntdll.pdb Profile from mouse moving over video: https://cleopatra.io/#report=2446d6e7f7ac8d03bc765e057755f56ed12bbb75&filter=%5B%7B%22type%22%3A%22FocusedCallstackPrefixSampleFilter%22,%22name%22%3A%22(root)%22,%22focusedCallstack%22%3A%5B0%5D,%22appliesToJS%22%3Afalse%7D%5D&selection=0,103,104,105 Most time spent in 0xa59a4 ntdll.pdb Profile from mouse moving over video, with new blank profile, no addons etc: https://cleopatra.io/#report=c75f5948361e15b40df12c759ad66b429a8aaa06&selection=0,102,103,104,105,106,107,1,108,109,110,111,112,113,114,115,159,116,160,161,162,163,166,167,168
Reporter | ||
Updated•8 years ago
|
Reporter | ||
Comment 1•8 years ago
|
||
About:Support info added.
Reporter | ||
Comment 2•8 years ago
|
||
Profile with hardware acceleration disabled: https://cleopatra.io/#report=cfef1884fd0891b760fbcf1e00e2e610aa8991b9&selection=0,116,117,118,119,120,121,1,122,123,124,125,126,127,128,165,166,167,168,169,174,175,176,177,178 Not as bad, but still show high CPU use with mouse moving over video.
Comment 3•8 years ago
|
||
Confirmed here on Nightly (64bit) on Windows 7 (64bit). First high CPU is shown when you move mouse over video, but it's also highly visible when you use seek preview.
Updated•8 years ago
|
Comment 4•8 years ago
|
||
Same with stable and ESR Firefox and looks like Chrome is also affected by this.
Reporter | ||
Comment 5•8 years ago
|
||
BTW, CPU usage with mouse moving over video is about 40% lower with e10s disabled.
Updated•8 years ago
|
Is it running out of GPU memory? Does setting media.video-queue.default-size=3 make a difference?
Reporter | ||
Comment 7•8 years ago
|
||
The GPU has 1GB of GDDR5 RAM. It uses about 460GB with media.video-queue.default-size=10 (default), and maybe 420GB with media.video-queue.default-size=3. CPU use is unchanged.
Comment 8•8 years ago
|
||
At least part of the profile shows that some JS from Google is doing pretty frequent queries for screen dimensions, for which we send sync messages to the parent. Bug 1194751 was filed back in the day to get rid of the sync messaging for PScreenManager.
Comment 9•8 years ago
|
||
Is there anything actionable in here, k17e? Possibility for movement?
Richard - does YouTube need to query the screen dimensions frequently?
Comment 11•8 years ago
|
||
Would it be possible to see a stack trace - obfuscated would be fine - to help us track where these calls are coming from?
Updated•8 years ago
|
Comment 12•8 years ago
|
||
(In reply to Richard Leider from comment #11) > Would it be possible to see a stack trace - obfuscated would be fine - to > help us track where these calls are coming from? Sure - here's what I was able to extract from the profile: g.ub/<() @ base.js:83 g.G/k<() @ base.js:223 g.ae() @ base.js:215 It then appears to call into the screen dimension properties of a MouseEvent.
Updated•8 years ago
|
Updated•8 years ago
|
YouTube are looking into it but have nothing to report.
Updated•7 years ago
|
Comment 14•7 years ago
|
||
@ Karl Dubost :karlcow - I saw that you helped tracking with bug #1299765, can you also see if YouTube team tracking this issue on their tracker, as we got no reply from long time from Richard Leider.
Comment 15•7 years ago
|
||
Virtual_ManPL, I can remind of the issue on the mailing-list, but I don't have special powers for looking into their bug tracker ;) (though I wish I could). Let me try. Contacted the partner mailing-list.
Comment 16•7 years ago
|
||
for the paper trail, Anthony and I have contacted Richard Leider and other people at YouTube. So far nothing new to report with regards to the resolution of this issue.
Comment 17•7 years ago
|
||
workaround |
Thank you very much for the follow up reply. Still it's kinda ridiculous, that Google developers can't fix YouTube player fast enough... as it's over 3 months... For time being there is workaround available, which uses buildin Firefox video player - https://addons.mozilla.org/addon/html5-video-everywhere/
Comment 18•7 years ago
|
||
timbugzilla@gmail.com, do you think you could create new cleopatra profile using Nightly? (for some reason the profile in comment 2 doesn't have symbols) I couldn't see much cpu usage on linux, so perhaps this is really Windows specific.
Reporter | ||
Comment 19•7 years ago
|
||
Will do when I get a chance.
Comment 20•7 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #18) > timbugzilla@gmail.com, do you think you could create new cleopatra profile > using Nightly? > (for some reason the profile in comment 2 doesn't have symbols) > > I couldn't see much cpu usage on linux, so perhaps this is really Windows > specific. Maybe mine will be some of use. Firstly, I was moving mouse cursor over movie to get YouTube player menu shown a few times. Next, I was circling mouse cursor over thumbnails in recommendation movie section, also done a few times.
Updated•7 years ago
|
Reporter | ||
Comment 22•7 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #18) > timbugzilla@gmail.com, do you think you could create new cleopatra profile > using Nightly? > (for some reason the profile in comment 2 doesn't have symbols) > > I couldn't see much cpu usage on linux, so perhaps this is really Windows > specific. Profiles made on the following page, with video playing in cinema mode: https://www.youtube.com/watch?v=621Nk3Ubz4A
Reporter | ||
Comment 23•7 years ago
|
||
Reporter | ||
Comment 24•7 years ago
|
||
Profile made with the gecko profiler add-on on 2017-01-25 win64 nightly. https://clptr.io/2jUbrca (also attached as file)
Reporter | ||
Comment 25•7 years ago
|
||
Comment 26•7 years ago
|
||
mstange, we have still no symbols. See comment 24.
Comment 27•7 years ago
|
||
But based on the symbols there are, comment 8 still sounds very valid.
Comment 28•7 years ago
|
||
What about my profile in Comment 20? https://cleopatra.io/#report=106d959fc033e33672a555ff47940139fa7353c8
Reporter | ||
Comment 29•7 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #26) > mstange, we have still no symbols. See comment 24. Any luck with the attached file for the "Profile made with the gecko profiler add-on on 2017-01-25 win64 nightly"?
Comment 30•7 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #26) > mstange, we have still no symbols. See comment 24. Noted. I'll investigate. Could be caused by the "NetworkError" problem that Sean had.
Reporter | ||
Comment 31•7 years ago
|
||
Is the need info flag still needed, given that symbols aren't available from the profiler currently?
Comment 32•7 years ago
|
||
I just pushed an update to the gecko profiler addon (2.0.29). Tim, can you try again with that version? Please also make sure that the "Waiting for symbol tables [...]" overlay at the top has disappeared before you save the profile. And if there's an error in the web console (Tools -> Web Developer -> Web Console), please paste that error here. Thanks!
Updated•7 years ago
|
Comment 33•7 years ago
|
||
I redone my test and profile is here - https://perfht.ml/2kXw21a + attached in Comment 33 Taken with Gecko Profiler 2.0.31 with these settings: - Interval = 0,01ms - Buffer size = 900MB - Threads = GeckoMain,Compositor - Features = Stack walk, JavaScript, Task tracer
Reporter | ||
Comment 34•7 years ago
|
||
Hopefully this works: https://perfht.ml/2m4Xmd4
Comment 35•7 years ago
|
||
All the processes seem to be mostly waiting. Synthetic mouse event handling does show up there a tiny bit, but still I don't see very long ticks. Hmm, I wonder if the synthetic mouse event handling might just push ticks to be slow enough in some cases. ehsan, since you've been looking at Gecko profiler profiles recently, does this ring any bells?
Comment 36•7 years ago
|
||
The threads that show up in the profile in comment 34 don't show any performance issues in particular. In my experience this is usually an indicator that another thread in the background may be using a lot of CPU. Tim, can you please capture another profile with all of the threads running? In order to do this, please click on the icon for the profiler add-on in the toolbar, expand Settings, and under Threads, replace the default value (which should be "GeckoMain,Compositor") with "," (that is, just a comma) and click on "Apply (Restart Profiler)". After you have done this, when you experience the high CPU usage and jank, please capture another profile and post the URL here. Thanks in advance for your continued help here!
Comment 37•7 years ago
|
||
Unfortunately for me this will be impossible due to bug #1344576. Any ideas?
Reporter | ||
Comment 38•7 years ago
|
||
Yes, unfortunately I am getting that crash too.
Comment 39•7 years ago
|
||
(In reply to Virtual_ManPL [:Virtual] - (please needinfo? me) from comment #37) > Unfortunately for me this will be impossible due to bug #1344576. Any ideas? Ah that's really annoying. :( I have two ideas: * Can you try unchecking the JavaScript feature from the profiler UI? I'm not 100% sure if this crash is caused by this feature but perhaps it is, and removing it will allow you to successfully capture a profile? * Can you try running older builds and profiling on those? But please be careful to run the older builds on a new profile because sometimes we may have backwards incompatible changes that may corrupt a profile if you run an older build on it. I also have set up an older Windows testing machine with slow hardware at the office which I can use for testing this tomorrow, so I won't clear my needinfo until I get a chance to do some testing of my own on this. Just to double check, all I need to do to reproduce this is the instructions in comment 0, is that correct?
Comment 40•7 years ago
|
||
(also setting a dependency on bug 1194751 which will hopefully be fixed soon since it was mentioned earlier here.)
Can this be moved out of the playback component?
Updated•7 years ago
|
Comment 42•7 years ago
|
||
(In reply to :Ehsan Akhgari from comment #39) > Just to double check, > all I need to do to reproduce this is the instructions > in comment 0, is that correct? Yes, you could also see my comment #20 > (Virtual_ManPL [:Virtual] - (please needinfo? me) from comment #20) > > Firstly, I was moving mouse cursor over movie to get YouTube player menu > shown a few times. > Next, I was circling mouse cursor over thumbnails in recommendation movie > section, also done a few times. I will also redo the test with your advice soon. (In reply to Anthony Jones (:kentuckyfriedtakahe, :k17e) from comment #41) > Can this be moved out of the playback component? Done, as it's reproducible on all browsers per awful and poor website YouTube coding.
Comment 43•7 years ago
|
||
Thank you very much Ehsan Akhgari! Your tips were the great help, as I was finally able to get the working no crashy profile - https://perfht.ml/2lQZ04W + attached in comment 43 Taken with Gecko Profiler 2.0.34 with these settings: - Interval = 100ms - Buffer size = 90MB - Threads = , - Features = Stack walk
Comment 44•7 years ago
|
||
I just took a look through this profile, and I just see a lot of threads mostly waiting. :/ Maybe I missed something?
Comment 45•7 years ago
|
||
I don't see anything suspicious in this profile either. Virtual_ManPL, what is the actual CPU usage? If there really is above 60% CPU usage, it must be happening on a background thread that is not registered with the profiler. Only an external profiler could tell us about that. For example Concurrency Visualizer. The only other bug about high CPU usage after video playback that I'm aware of is bug 1344772. But I don't see any calls to "NotifyDataArrived" in it, so it seems unlikely that bug 1344772 would help here.
Comment 46•7 years ago
|
||
I took a look at this one too and couldn't find anything of interest either.
Comment 47•7 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #45) > what is the actual CPU usage? nearly 50% usage of all CPU cores in all 3 STR mentioned below (In reply to Markus Stange [:mstange] from comment #45) > The only other bug about high CPU usage after video playback that I'm aware > of is bug 1344772. But I don't see any calls to "NotifyDataArrived" in it, > so it seems unlikely that bug 1344772 would help here. For me it's very bad and poor YouTube website coding, as it's reproducible on all browsers, even when movie isn't playing. I redone my test with with Gecko Profiler 2.0.34 with these settings: - Interval = 0,01ms - Buffer size = 900MB - Threads = , - Features = Stack walk, Task tracer maybe it will be more detailed, so please have a look one more time. Moving mouse in circles between 2 thumbnails (movie is paused) https://perf-html.io/public/e26e8191f0c2c3a203b6b02f3f5d0ddaedef38b5/calltree/?thread=52 Moving mouse in circles between mute button and no player space (movie is paused) https://perf-html.io/public/cb6ac2bc971c41d08a75634352b3d4ab9812b8be/calltree/?thread=43 Moving mouse in movie seek preview (movie is paused) https://perf-html.io/public/d93e41d9bd9778bd7b8ee07b2ede251c224f3312/calltree/?thread=47
Comment 48•7 years ago
|
||
What I see there is mostly display list building and layerization, and a bit of rasterization. The latter should be helped by webrender, the former two are bug 1204549.
Comment 49•7 years ago
|
||
(In reply to Virtual_ManPL [:Virtual] - (please needinfo? me) from comment #47) > (In reply to Markus Stange [:mstange] from comment #45) > > what is the actual CPU usage? > nearly 50% usage of all CPU cores in all 3 STR mentioned below > > (In reply to Markus Stange [:mstange] from comment #45) > > The only other bug about high CPU usage after video playback that I'm aware > > of is bug 1344772. But I don't see any calls to "NotifyDataArrived" in it, > > so it seems unlikely that bug 1344772 would help here. > For me it's very bad and poor YouTube website coding, as it's reproducible > on all browsers, even when movie isn't playing. Sorry what??? so what is there to fix on our side?
Comment 50•7 years ago
|
||
This bug is in the Tech Evangelism product. It's still nice to look for Firefox perf improvement opportunities even if we aren't worse than other browsers.
Comment 51•7 years ago
|
||
My bad, I thought this was bug 1329630
Comment 52•7 years ago
|
||
I'm highly confident in the profile analysis done by my esteemed peers. Clearing needinfo. :)
Updated•7 years ago
|
Comment 55•7 years ago
|
||
1 year passed and YouTube developers still didn't fix this bloat issue... FYI - Some more info from duped bug #1402752 >(smartfon.reddit wrote in bug #1402752 comment #0) >> User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) >> Gecko/20100101 Firefox/56.0 >> Build ID: 20170918210324 >> >> Steps to reproduce: >> >> It uses 2-5 times more CPU than others while playing YouTube videos. I was >> advised to use a Gecko profiler and post the results here. >> >> Profiler starts. YouTube URL is loaded. The CPU usage spikes to 20% - 40% >> for a few seconds. Profiler captures: https://perfht.ml/2ynf2p0 >> >> Hover the mouse over the video multiple times to make the rewind bar >> visible. Nothing is clicked. CPU is 15% - 25% : https://perfht.ml/2ymRgJX >> >> Rewind the video multiple times. CPU usage 20% - 30%: >> https://perfht.ml/2ymUInN >> >> This one shows idle video playback with no interactions. No recent >> activities that could have caused it to cause a spike. Just plain Firefox >> decoding and playing the video. CPU usage 8% - 20%. One of the processes >> that has the higher RAM usage is responsible for most of the CPU usage, but >> it's usually distributed between multiple firefox.exe processes: >> https://perfht.ml/2ymLbNq >> >> Dell Inspiron i5577. Intel i7-7700HQ with Intel 630 graphics and latest >> drivers. GPU has hardware VP9 decoding. Tested with VP9 and mp4a in "Stats >> for Nerds". Completely fresh profile with no changes. CPU usage goes below >> 1% when the video is paused. Tested with and without antivirus. Tested with >> YouTube's new material and old layouts. Tested with Firefox 55 - 58, with 57 >> and 58 being slightly better in idle usage. This is not a new problem that >> has started out of the blue.
Comment 57•7 years ago
|
||
(In reply to Virtual_ManPL [:Virtual] - (please needinfo? me - so I will see your comment/reply/question/etc.) from comment #55) > 1 year passed and YouTube developers still didn't fix this bloat issue... > > FYI - Some more info from duped bug #1402752 This is a follow up to that bug report. Apparently, Windows 10 Task Manager's "Processes" tab (new design) doesn't report CPU numbers accurately. The old "Details" tab (Windows 7 style) shows lower CPU numbers, which is on par with 3rd party Sysinternals Process Explorer tool. Firefox still uses more CPU than Chrome. Here are the more accurate numbers in response to Comment 55 The YouTube tab is loaded, video starts playing: 20%-27% for a few seconds. Hover the mouse over the video multiple times to make the rewind bar visible: 12%-18%. Rewind the video multiple times: Up to 21%. Idle playback while nothing is touched: Average of 3.5% (Chrome 1%).
Comment 58•6 years ago
|
||
Tim - Is this issue still happening today?
Comment 59•6 years ago
|
||
I'm on nightly (61) and the CPU usage is still average 30% for youtube, single tab only.
Comment 60•6 years ago
|
||
Hi Adam, is this bug : https://bugzilla.mozilla.org/show_bug.cgi?id=1445501 a duplicate, or is something else? Thanks.
Updated•5 years ago
|
Reporter | ||
Comment 61•4 years ago
|
||
This still seems to happen with Firefox beta (76.0b8 64-bit). I've attached my about:support output.
Reporter | ||
Comment 62•4 years ago
|
||
Comment 63•4 years ago
|
||
A new performance profile might be useful. Could you perhaps try to create such?
Comment 64•3 years ago
|
||
I was still able to reproduce the issue.
https://prnt.sc/v5d9ri
I've also recorded a performance profile.
Tested with:
Browser / Version: Firefox Nightly 84.0a1 (2020-10-21)
Operating System: Windows 10 Pro
Updated•3 years ago
|
Comment 65•3 years ago
|
||
The profile continues to be dominated by JavaScript code on YouTube that monitors mouse events.
Updated•3 years ago
|
Comment 66•2 years ago
|
||
Moving open bugs with topperf keyword to triage queue so they can be reassessed for performance priority.
Updated•2 years ago
|
Comment 67•2 years ago
|
||
This issue still occurs.
Tested with:
Browser / Version: Firefox Nightly 102.0a1 (2022-05-16)
Operating System: Windows 10 Pro
Comment 68•2 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:denschub, since the bug has high severity and recent activity, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Reporter | ||
Comment 71•2 years ago
|
||
It still does this. Quickly rotating the cursor (by using mouse) on this video spikes CPU use up to 40% from about 20%.
https://www.youtube.com/watch?v=Wof_FWYcDWA
This with an AMD 5400U laptop.
Comment 72•2 years ago
|
||
Would you have a new performance profile for this?
Reporter | ||
Comment 73•2 years ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #72)
Would you have a new performance profile for this?
Using current beta, have AV1 codec turned off on youtube (prefer AV1 for SD, under youtube playback settings), new blank profile with no extensions.
Not moving mouse:
https://share.firefox.dev/3SAku1T
Rapidly moving mouse over video:
https://share.firefox.dev/3vKXd3h
Big difference seems to be in nsThread::ProcessNextEvent
Comment 74•2 years ago
|
||
When not moving mouse browser can just play the video, so not too much needs to happen in the child process.
With mouse moving there are some rAF callbacks and what not and looks like intersection observers are used too etc.
But when comparing to Chrome for example on linux, AMD 5850u, I see higher cpu usage with Chrome than what I see with Nightly when moving mouse.
Comment 75•2 years ago
|
||
On a Windows 11 laptop (AMD 5800u) I see very similar behavior when comparing Edge to Nightly.
Edge uses more cpu time when moving mouse over the video.
Are you seeing very different behavior?
Reporter | ||
Comment 76•2 years ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #75)
On a Windows 11 laptop (AMD 5800u) I see very similar behavior when comparing Edge to Nightly.
Edge uses more cpu time when moving mouse over the video.
Are you seeing very different behavior?
Just checked, and it seems that Edge has about the same or slightly higher CPU time compared to FF beta. Chrome maybe slightly less than FF beta.
Thanks for looking into it. Is there anything that can be learned from this about reducing browser power consumption on pages with embedded video?
Comment 77•2 years ago
|
||
What can be learnt is that many web sites use lots of JS to do something. They could be optimized.
It might be worth to file a bug on Youtube. (But I don't know how to do that).
If you file such issue, could you link that here?
I guess we can close this bug. Resolved...not FIXED, not WFM, perhaps MOVED, since this is a youtube issue.
Description
•