Closed Bug 1300235 Opened 8 years ago Closed 2 years ago

Very high CPU usage and jank, after moving mouse cursor over YouTube video player or thumbnails

Categories

(Web Compatibility :: Site Reports, defect, P3)

x86_64
Windows

Tracking

(platform-rel +, firefox84 affected, firefox102 affected)

RESOLVED MOVED
Tracking Status
platform-rel --- +
firefox84 --- affected
firefox102 --- affected

People

(Reporter: timbugzilla, Assigned: denschub)

References

()

Details

(5 keywords, Whiteboard: [platform-rel-Youtube] [workaround is in comment #17][webcompat:sightline])

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
Attached file about_support.txt
About:Support info added.
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.
Status: UNCONFIRMED → NEW
Component: General → Audio/Video: Playback
Ever confirmed: true
Keywords: html5, reproducible
OS: Windows 10 → Windows
Product: Firefox → Core
Same with stable and ESR Firefox and looks like Chrome is also affected by this.
Has Regression Range: --- → irrelevant
Has STR: --- → yes
Version: Trunk → unspecified
BTW, CPU usage with mouse moving over video is about 40% lower with e10s disabled.
Is it running out of GPU memory? Does setting media.video-queue.default-size=3 make a difference?
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.
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.
Is there anything actionable in here, k17e? Possibility for movement?
Flags: needinfo?(ajones)
Richard - does YouTube need to query the screen dimensions frequently?
Flags: needinfo?(ajones)
Would it be possible to see a stack trace - obfuscated would be fine - to help us track where these calls are coming from?
Flags: needinfo?(mconley)
(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.
Flags: needinfo?(mconley) → needinfo?(rleider)
platform-rel: --- → ?
Whiteboard: [platform-rel-Youtube]
platform-rel: ? → +
YouTube are looking into it but have nothing to report.
Rank: 33
@ 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.
Severity: normal → major
tracking-e10s: ? → ---
Flags: needinfo?(kdubost)
Keywords: perf, topperf
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.
Flags: needinfo?(kdubost)
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.
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/
Summary: High cpu usage and jank on youtube pages → Very high CPU usage and jank, after moving mouse cursor over YouTube video player
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.
Flags: needinfo?(timbugzilla)
Will do when I get a chance.
(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.
Summary: Very high CPU usage and jank, after moving mouse cursor over YouTube video player → Very high CPU usage and jank, after moving mouse cursor over YouTube video player or thumbnails
(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
Profile made with the gecko profiler add-on on 2017-01-25 win64 nightly. https://clptr.io/2jUbrca (also attached as file)
mstange, we have still no symbols. See comment 24.
Flags: needinfo?(mstange)
But based on the symbols there are, comment 8 still sounds very valid.
(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"?
(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.
Flags: needinfo?(mstange)
Is the need info flag still needed, given that symbols aren't available from the profiler currently?
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!
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
Hopefully this works: https://perfht.ml/2m4Xmd4
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?
Flags: needinfo?(bugs) → needinfo?(ehsan)
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!
Flags: needinfo?(ehsan)
Unfortunately for me this will be impossible due to bug #1344576. Any ideas?
Flags: needinfo?(ehsan)
Flags: needinfo?(bugs)
Whiteboard: [platform-rel-Youtube] → [platform-rel-Youtube] [workaround is in comment #17]
Yes, unfortunately I am getting that crash too.
(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?
(also setting a dependency on bug 1194751 which will hopefully be fixed soon since it was mentioned earlier here.)
Depends on: 1194751
Can this be moved out of the playback component?
Component: Audio/Video: Playback → Desktop
Product: Core → Tech Evangelism
(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.
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
I just took a look through this profile, and I just see a lot of threads mostly waiting. :/ Maybe I missed something?
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.
Flags: needinfo?(mstange)
I took a look at this one too and couldn't find anything of interest either.
Flags: needinfo?(ehsan)
(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
Flags: needinfo?(mstange)
Flags: needinfo?(mconley)
Flags: needinfo?(ehsan)
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.
Flags: needinfo?(mstange)
(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?
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.
My bad, I thought this was bug 1329630
I'm highly confident in the profile analysis done by my esteemed peers. Clearing needinfo. :)
Flags: needinfo?(mconley)
Do you still need info on this bug?
Flags: needinfo?(timbugzilla)
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.
(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%).
Tim - Is this issue still happening today?
Flags: needinfo?(timbugzilla)
Priority: -- → P3
I'm on nightly (61) and the CPU usage is still average 30% for youtube, single tab only.
Hi Adam, is this bug : https://bugzilla.mozilla.org/show_bug.cgi?id=1445501 a duplicate, or is something else? Thanks.
Flags: needinfo?(astevenson)
Flags: needinfo?(astevenson)
Product: Tech Evangelism → Web Compatibility

This still seems to happen with Firefox beta (76.0b8 64-bit). I've attached my about:support output.

Flags: needinfo?(timbugzilla)
Attached file about:support output

A new performance profile might be useful. Could you perhaps try to create such?

Flags: needinfo?(timbugzilla)

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

The profile continues to be dominated by JavaScript code on YouTube that monitors mouse events.

Assignee: nobody → dschubert

Moving open bugs with topperf keyword to triage queue so they can be reassessed for performance priority.

Performance Impact: --- → ?
Keywords: topperf
Performance Impact: P3 → ---

This issue still occurs.

Tested with:
Browser / Version: Firefox Nightly 102.0a1 (2022-05-16)
Operating System: Windows 10 Pro

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.

Flags: needinfo?(rleider) → needinfo?(dschubert)
Flags: needinfo?(dschubert)

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.

Flags: needinfo?(timbugzilla)

Would you have a new performance profile for this?

Flags: needinfo?(timbugzilla)

(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

Flags: needinfo?(timbugzilla)

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.

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?

Flags: needinfo?(timbugzilla)

(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?

Flags: needinfo?(timbugzilla)

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.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → MOVED
Whiteboard: [platform-rel-Youtube] [workaround is in comment #17] → [platform-rel-Youtube] [workaround is in comment #17][webcompat:sightline]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: