Open Bug 1910820 Opened 7 months ago Updated 1 month ago

Youtube laggy UI elements recently https://share.firefox.dev/4fiC1XE

Categories

(Core :: JavaScript Engine, defect, P2)

Firefox 128
x86_64
Windows
defect

Tracking

()

UNCONFIRMED

People

(Reporter: z.n.a.r.u.t.o.z, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

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

Steps to reproduce:

Browsing Youtube as per usual on the current firefox version

Actual results:

Extremely laggy UI elements

Mousing over the seek bar and navigating the video player, scrolling around page to view comments takes ages to load. Video will become a black screen while the elements are slowly loading.

Expected results:

Should be smooth as per usual

The Bugbug bot thinks this bug should belong to the 'Core::Graphics' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics
Product: Firefox → Core

Hmm, almost all th time in the profile is spent inside js that the page is running.

The same issue since Firefox 128.02 on Ubuntu, Macos and Windows

Tim, do you think the JS team should have a look here?

Severity: -- → S3
Flags: needinfo?(tnikkel)
OS: Unspecified → Windows
Priority: -- → P2
Hardware: Unspecified → x86_64
Duplicate of this bug: 1908628

Another profiling for lagging UI from bug 1904394 comment4 : https://share.firefox.dev/4fqYt0S

Same issue here with similar profiles. YouTube UI (not the videos themselves) is very laggy and unresponsive in Firefox. This is consistent for me on both Windows and MacOS. This is not super new and has been going on at least a couple of weeks.

I was partially scrolled down the page and watching my cursor take a whole second to turn into a text select cursor when hovering over text, when I took this brief profile:

https://share.firefox.dev/4flJXaC

Similar to the profile shared above it seems to all be in JS which causes major delays / jank.

I'll put this in the js component for now, even if the issue isn't in our javascript engine, they should be able to tell us more I think? Feel free to move to a better place.

Component: Graphics → JavaScript Engine
Flags: needinfo?(tnikkel)

Thanks for the reports.

I've tried loading Youtube and scrolling through several screens of videos, and I haven't been able to reproduce any UI slowdown.

The linked profiles all seem to have been submitted with URLs removed, which means that the profile contains minified function names, but no way to get from those to the original JS source code. Without that, it's hard to investigate.

To make further progress, it would be helpful if one of the reporters experiencing this problem could provide a new profile, uploaded with the "Include resource URLs and paths" box checked. While you're at it, it would also be helpful to include extension information. One possibility (maybe the most likely one?) is that a browser extension is causing the slowdown, which would explain why I don't see it myself.

Alternatively, you could try running Firefox in Troubleshooting mode to disable extensions and customizations, and see if you can reproduce the slowdown. If not, then we can narrow it down to an extension or change in settings.

If you can reproduce a slowdown in troubleshooting mode, then it would be helpful to get a very detailed description of the steps that you took to do so.

Here's a profile in troubleshooting mode with the URLs enabled (disabling my extensions seems to makes youtube perform even worse somehow)

https://share.firefox.dev/4fxUShM

As for the steps, I just turned on troubleshooting mode, open the youtube homepage in a new tab and as soon as I open a video the performance drops horribly.

Multiple elements like the video suggestions and comments take quite a while to load in, the player takes seconds to respond to any interaction and the page just becomes borderline unusable for a random amount of time whenever I interact with it or scroll up/down.

I also sometimes get the page slowing down firefox notification at the top

Huh. This is weird.

Inverting the call stack in that profile and looking at self time, 6 of the top 7 functions, adding up to ~2/3 of the overall samples, are spent in code from this file. (The seventh is our self-hosted implementation of the next method of the Set iterator, which is being called from one of those functions.) Specifically, the hot code appears to be spent in the Angular signals implementation. For example, a full 20% of our runtime is spent here. If I try to replicate the same situation on my computer, I see barely any samples in that code.

I'm not an Angular expert, but I believe this is the part of Angular that tracks state in an attempt to optimize rendering updates. For some reason, your machine is doing much more work propagating state changes, which I think probably implies that state is changing more often.

Shot in the dark: what's the refresh rate on your display?

Interesting. My desktop Windows computer is running at 144Hz. But my M2 MBP is running at 60Hz and it happens there, too. (It supports 120Hz ProMotion but it's off). Both machines show the issue, but it does feel a lot worse on the windows machine.

I poked around on my Mac a little today to get a consistent repro and have not come up with one yet. It's not 100% consistent, but it's pretty frequent. On Windows it seems to repro a lot faster and easier.

It's at 120Hz at the moment, but it can do 165Hz.

I just tested at 60Hz and 165Hz but the behavior is the same.

Perhaps a copy of about:support from affected machines might help us spot something the machines have in common maybe?

I just did another test in troubleshooting mode, but this time I opened YouTube in a private window so I wasn't logged in.
Suddenly I had no issues doing the same steps I did in my previous profile.
I tried watching some more videos just to be sure, but no, everything's fine.

So here's one where I start logged in, watch a video, log out midway and watch the same video again.

https://share.firefox.dev/3YuXhne

I'm having the exact same problem since few weeks, I tried what Stan VL said, going into private mode, and the problem is gone on it.
Maybe it has something to do with being connected to a google account?

Posting another profile capture from my encounter with this bug: https://share.firefox.dev/4d8KKKC ```
Duplicate of this bug: 1911442

I've similar issues: https://share.firefox.dev/4dxtDSD

(In reply to Iain Ireland [:iain] from comment #9)

Thanks for the reports.

I've tried loading Youtube and scrolling through several screens of videos, and I haven't been able to reproduce any UI slowdown.

The linked profiles all seem to have been submitted with URLs removed, which means that the profile contains minified function names, but no way to get from those to the original JS source code. Without that, it's hard to investigate.

To make further progress, it would be helpful if one of the reporters experiencing this problem could provide a new profile, uploaded with the "Include resource URLs and paths" box checked. While you're at it, it would also be helpful to include extension information. One possibility (maybe the most likely one?) is that a browser extension is causing the slowdown, which would explain why I don't see it myself.

Alternatively, you could try running Firefox in Troubleshooting mode to disable extensions and customizations, and see if you can reproduce the slowdown. If not, then we can narrow it down to an extension or change in settings.

If you can reproduce a slowdown in troubleshooting mode, then it would be helpful to get a very detailed description of the steps that you took to do so.

Hi, I reported this very early on reddit, and I did all of the following.

Confirmed problem is still there in troubleshooting mode.
Confirmed it isnt there in private windows (even with all extensions enabled in private window).
Confirmed it gradually gets worse the more browsing of youtube is done in the tab. Closing the tab and opening a new one recovers performance, refreshing the tab also recovers performance (not as much as making a new one).
If I disable comment rendering which is possible with enhancer for youtube extension, then loading videos is really fast, a big part of the lag is loading video comments, however other parts of youtube website also have slowdowns, so this isnt a totla workaround.

I have yet to run the profile feature, but will try to do so within the next 24 hours and will run it in troubleshooting mode.

Been also getting the "This page is slowing down Firefox. To speed up your browser stop this page" prompt in Firefox when browsing youtube occasionally

It's very interesting that this only occurs when logged in, and doesn't occur in private mode.

One possibility that this opens up is that your account may be part of some A/B testing by Youtube, and you're being served a slightly different version of the website. If that's the case, then I would expect this to also affect older versions of Firefox, as long as you're logged in with the same account. Old versions of Firefox can be downloaded here. I think Firefox ESR115 should be sufficiently old to test this hypothesis. If you go here and then select your OS (probably win64/mac/linux-x86_64) and locale (probably en-US), then you can install the first ESR115 release. If you see a similar slowdown there, then the thing that's changed recently is probably Youtube, not Firefox. If you don't see a slowdown, it would be interesting to also try the latest version of 127, to see whether this is really a problem in Firefox 128 specifically.

Looking at the profile in comment 15 with a side-by-side comparison, I don't see any differences in the code versions, so I'm not incredibly optimistic about this hypothesis, but maybe there's some higher-level script that differs that is somehow doing more work.

Well, it seems the A/B testing theory is correct because I wanted to test the older firefox version today but my Youtube interface looks totally different.
And the issue is now gone of course :)

I'm not sure if it's worth investing more time into this if Youtube is going to randomly change the UI every few weeks.

The problem magically disappeared for me too

i've recently had a problem where youtube freezes a 2-5 seconds into any video. It freezes the entire browser while audio still continues. (Freeze as in "I have to use task manager for this or it won't close")
i thought that it was because i was still on 128, so i updated to 129 but it's gotten even worse.
disabling my extensions, logged in or logged out, it happens anyway. the only way to not have this freeze occur is to go in Full Screen Mode before the video starts playing. Has anyone experienced this too?

Can you take a profil using https://profiler.firefox.com/ and upload it?

Flags: needinfo?(oceankeeper11)

(In reply to Timothy Nikkel (:tnikkel) from comment #26)

Can you take a profil using https://profiler.firefox.com/ and upload it?

i don't know how. i'm not a programmer, i searched help on reddit and got sent here

Flags: needinfo?(oceankeeper11)

The problem has gone for me, comments load super fast, toggling latest, popular, oldest as snappy as private windows as well.

I did recently disable gfx canvas accelerated ((I changed to the default), it is possible this fixed it, although I am more inclined to think youtube devs have been doing some tinkering, and changed the code I load up on my account, but for peace of mind I will toggle that pref back at some point and test if it slows down again.

You don't need to know anything about programming to use the profiler:

  • Go to https://profiler.firefox.com/ and enable the button
  • Set it to Media and start recording a log
  • Try to watch a YouTube video
  • The profiler will open a page automatically when you stop it. Click on Upload Local Profile at the top-right corner and copy the link
  • Paste the link here
Flags: needinfo?(oceankeeper11)

(In reply to azu6cjnyq from comment #29)

You don't need to know anything about programming to use the profiler:

  • Go to https://profiler.firefox.com/ and enable the button
  • Set it to Media and start recording a log
  • Try to watch a YouTube video
  • The profiler will open a page automatically when you stop it. Click on Upload Local Profile at the top-right corner and copy the link
  • Paste the link here

https://share.firefox.dev/4csxKy7 done.

Flags: needinfo?(oceankeeper11)

(In reply to oceankeeper11 from comment #30)

(In reply to azu6cjnyq from comment #29)

You don't need to know anything about programming to use the profiler:

  • Go to https://profiler.firefox.com/ and enable the button
  • Set it to Media and start recording a log
  • Try to watch a YouTube video
  • The profiler will open a page automatically when you stop it. Click on Upload Local Profile at the top-right corner and copy the link
  • Paste the link here

https://share.firefox.dev/4csxKy7 done.

This profile is 45 ms long. You need to start the profiler and let it run while you are experiencing the issue, and then stop it after the issue has happened. It collects information about what Firefox is spending time on so we can diagnose the issue.

Flags: needinfo?(oceankeeper11)

The issue also vanished for me. Looks like this was a YouTube JS problem. However it is still possible that whatever they were doing was specifically incompatible with FF. We would only know for sure if the Google engineers who no doubt have seen this thread might contribute some information.

The more recent comments seem to be unrelated.

Here's another one shared by a support forum user: https://share.firefox.dev/3MzzStL

He's been experiencing the issue for two weeks and it has not vanished yet.

I think I am experiencing something similar for the last week or so. After some time spending on Youtube the UI becomes very laggy and unresponsive, but videos itself play fine. When it happens my CPU and RAM usage go very high, then drop, then go high and drop again, and it happens continuously until I restart Firefox or close all opened Youtube tabs. I can always reproduce this issue by doing the following:

  1. Go on the Youtube home page.
  2. Scroll to the very bottom of the home page, until it stops.
  3. Refresh the page.
  4. Repeat multiple times.

After performing the steps listed above Youtube becomes unusable, and I can see continuous spikes in CPU and RAM usage. This profile was recorded after performing the above steps while Firefox was just idling on the Youtube home page - https://share.firefox.dev/3YLKwEU

The issue is also reproducible on clean profile with no extensions installed.

(In reply to Selim Şumlu from comment #33)

Here's another one shared by a support forum user: https://share.firefox.dev/3MzzStL

He's been experiencing the issue for two weeks and it has not vanished yet.

This profile shows almost no time spent on Youtube. The active tabs appear to be Facebook, live.com, amazon.com, and a little bit turkishairlines.com.

(In reply to Alexey104 from comment #34)

I think I am experiencing something similar for the last week or so. After some time spending on Youtube the UI becomes very laggy and unresponsive, but videos itself play fine. When it happens my CPU and RAM usage go very high, then drop, then go high and drop again, and it happens continuously until I restart Firefox or close all opened Youtube tabs. I can always reproduce this issue by doing the following:

  1. Go on the Youtube home page.
  2. Scroll to the very bottom of the home page, until it stops.
  3. Refresh the page.
  4. Repeat multiple times.

After performing the steps listed above Youtube becomes unusable, and I can see continuous spikes in CPU and RAM usage. This profile was recorded after performing the above steps while Firefox was just idling on the Youtube home page - https://share.firefox.dev/3YLKwEU

The issue is also reproducible on clean profile with no extensions installed.

Huh, this is somewhat interesting. That profile shows that the Youtube tab is spending essentially all its non-idle time in GC/CC.

The first time I tried reproducing this locally, by scrolling down a lot on the Youtube home page, I actually managed to reproduce something similar: https://share.firefox.dev/46UUDJr. Visually, it looked like Youtube's infinite scroll was allowing me to continue scrolling past the end of the loaded videos and create a large number of grayed-out placeholders. Trying to reproduce it again, however, I can't get into the same state. When I scroll to the bottom, I get a small handful of placeholders, and then nothing else loads until Youtube can populate those with actual thumbnails. I'm not sure what changed.

I'm not convinced that the scrolling issue I managed to trigger is related to the general problem of Youtube slowing down when not stress-testing the infinite scroll.

Visually, it looked like Youtube's infinite scroll was allowing me to continue scrolling past the end of the loaded videos and create a large number of grayed-out placeholders.

Yes, this is exactly what I see.

Trying to reproduce it again, however, I can't get into the same state. When I scroll to the bottom, I get a small handful of placeholders, and then nothing else loads until Youtube can populate those with actual thumbnails.

When at the bottom of the home page, if, instead of refreshing the page I click on the Youtube logo or Home button and scroll down again, those gray placeholders begin to accumulate in large quantities until they just stuck to render and memory usage goes higher and higher. If then I refresh the page, I can scroll normally again as you describe, but the UI becomes laggy and unresponsive. Closing just the "laggy tab" doesn't help, I need to either close all the other opened Youtube tabs, or restart Firefox. Never saw this behavior before, it started to happen recently. Just for the sake of curiosity I installed Chrome, and I see the same behavior with accumulating gray placeholders stucked at rendering, memory usage also goes high, but if I refresh the page there are no further lags and CPU/memory usage drops to normal.

Not sure if this is related to the discussed issue, but previously I saw no issues of that kind, just for the last week.

(In reply to Iain Ireland [:iain] from comment #35)

(In reply to Selim Şumlu from comment #33)

Here's another one shared by a support forum user: https://share.firefox.dev/3MzzStL

He's been experiencing the issue for two weeks and it has not vanished yet.

This profile shows almost no time spent on Youtube. The active tabs appear to be Facebook, live.com, amazon.com, and a little bit turkishairlines.com.

I've asked him record another one. Here it is: https://share.firefox.dev/3SZLB8t

(In reply to Selim Şumlu from comment #37)

I've asked him record another one. Here it is: https://share.firefox.dev/3SZLB8t

Hmm. That profile also doesn't show any CPU time spent on Youtube.

However, it does look like it's spending a very long time waiting for network requests. There are a lot of loads to URLs like "https://www.youtube.com/youtubei/v1/log_event?alt=json&key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8" that never complete. Looking back at the earlier profile, I see the same thing.

So the issue that your support forum user is experiencing seems to be different than the other reports in this bug: a problem with the network, not excessive CPU usage. I note that the profile info says the user has "SaveFrom.net asistan" and "Video DownloadHelper" extensions active. It might be worth trying to use Youtube with extensions disabled, in case one of those extensions is misbehaving. (Alternatively, maybe there's some sort of network misconfiguration or firewall issue? I don't know much about debugging network problems; I mostly stick to JS.)

(In reply to Iain Ireland [:iain] from comment #38)

(In reply to Selim Şumlu from comment #37)

I've asked him record another one. Here it is: https://share.firefox.dev/3SZLB8t

Hmm. That profile also doesn't show any CPU time spent on Youtube.

However, it does look like it's spending a very long time waiting for network requests. There are a lot of loads to URLs like "https://www.youtube.com/youtubei/v1/log_event?alt=json&key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8" that never complete. Looking back at the earlier profile, I see the same thing.

So the issue that your support forum user is experiencing seems to be different than the other reports in this bug: a problem with the network, not excessive CPU usage. I note that the profile info says the user has "SaveFrom.net asistan" and "Video DownloadHelper" extensions active. It might be worth trying to use Youtube with extensions disabled, in case one of those extensions is misbehaving. (Alternatively, maybe there's some sort of network misconfiguration or firewall issue? I don't know much about debugging network problems; I mostly stick to JS.)

Thanks for the explanation Iain. He can reproduce this on troubleshooting mode, so it shouldn't be an extension issue. I'm going to file a seperate bug about this.

Redirect a needinfo that is pending on an inactive user to the triage owner.
:willyelm, since the bug has recent activity, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(oceankeeper11) → needinfo?(wmedina)
Flags: needinfo?(wmedina)

Noticed similar issues the past week and a half to two weeks(ish) as well. Not sure what version it started on, but I'm currently on 133.

Issues are basically everything noted by OP, but there is also issues wherein the YouTube page freezes. Doesn't freeze the tab itself as you can still do most everything fine, but can't interact with the webpage or player (which freezes to whichever frame it was on). Reloading sometimes doesn't register, opening new tabs of any kind for YouTube can lag out badly, and opening something (clicking on a video or your subscriptions, for example) may exhibit the same issues and/or load agonizingly slow.

It's not super consistent on how often it happens.

Attempted running in icognito mode as well as normal but with all extensions disabled or uninstalled. No noticeable changes as far as I can tell since the issues still pop up.

I've been having these issues too (starting sometime this week I think), and after looking around for similar experiences and potential solutions I came across one in a reddit comment that actually seems to have worked for me.
I changed "DNS over HTTPS" from "Increased Protection" to "Default Protection", which changed its status from active to off. I didn't make a note of it but I assume the provider, when it was active, was set to the default Cloudflare.
After a browser restart YouTube was finally back to normal.

Having a similar issue right now myself

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: