Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension is freezing some Youtube pages #1074

Open
1 task done
vitorrm opened this issue Aug 15, 2024 · 42 comments
Open
1 task done

Extension is freezing some Youtube pages #1074

vitorrm opened this issue Aug 15, 2024 · 42 comments
Labels
bug Something isn't working

Comments

@vitorrm
Copy link

vitorrm commented Aug 15, 2024

Have you tried to find similar issues (open or recently closed)?

  • Yes, this issue is not a duplicate

Browser

Google Chrome

Browser Version

Versão 127.0.6533.120 (Versão oficial) 64 bits

Extension or Userscript?

Extension

Extension/Userscript Version

3.0.0.16

Video link where you see the problem

https://www.youtube.com/watch?v=7qrEs5n9WlU

What happened?

Some youtube page videos are freezing when this extension is enabled, I only noticed it today, I turned all extensions off one by one until I tracked it down to this one.

I saw that in the ratings page of this extension there is another person reporting this same problem, so it is not restricted to me.

The problem does not happen when I load the page with the dev console opened, but as soon as I close it the page freezes. I have to close the browser tab to reload the page

How to reproduce/recreate?

Open the YT video from the field above with the dev console closed and the extension enabled and see that the page is freezing.

Will you be available for follow-up questions to help developers diagnose & fix the issue?

Yes

@vitorrm vitorrm added the bug Something isn't working label Aug 15, 2024
@bottleblue
Copy link

bottleblue commented Aug 16, 2024

This is happening to me too after the Firefox 129 update. The page will freeze and become unresponsive to mouse clicks but the audio still plays. Task Manager shows huge RAM usage for a couple Firefox processes, 1-5GB+.

Quitting Firefox doesn't close the processes in Task Manager. I have to end task on the Firefox processes that are using the high RAM in order for the other processes to close.

@donorsemen
Copy link

Seconded.
I have the same problem myself.
Firefox 129.0.1, flatpak, ubuntu 24.04, gnome 46, wayland (X is the same)

@Sahil12524
Copy link

here same I am using edge browser, and it is freezing entire web page.

@BlexToGo
Copy link

I have the same issue with Chrome Version 127.0.6533.120 (Official Build) (64-bit) on Windows 10 22H2. Video was playing for 2-3 seconds before the page completely froze and I couldn't do anything besides closing the tab.

@david1hung
Copy link

Extension seems to consistently cause a freeze when watching livestreams that support 1440p+ resolutions.
I have been trying to watch the OWCS livestreams on Overwatch Esports YouTube. Works fine when watching the 1080p VODs there.

@shibotto
Copy link

It seems to me that it's struggling a lot to relocate the buttons next to 👍 👎 .

@kokon191
Copy link

The problem does not happen when I load the page with the dev console opened, but as soon as I close it the page freezes. I have to close the browser tab to reload the page

Along with the comment another made above about the resolution and the button relocation attempts, it reminds me of an old issue that exhibited the exact same behavior (not sure if it's fixed).

@vitorrm You can retry with the dev console popped out instead of docking to the same window so that the youtube tab retains its resolution with the dev console active to see if the problem still persists and anything prints in the logs.

@vitorrm
Copy link
Author

vitorrm commented Aug 19, 2024

Yep, with the dev console popped out the problem does happen, here is the screenshot of the dev console while the page is frozen
image

@kokon191
Copy link

@vitorrm What resolution is your screen? And do you maximize your browser? Your cropped screenshot is a fair bit bigger than 1080p so I guess you have a 1440p monitor?

@vitorrm
Copy link
Author

vitorrm commented Aug 19, 2024

Yes, I do maximize the browser.
My monitor is a portable 4k 15.6 Inch monitor (from Aliexpress).

@Alf3rez
Copy link

Alf3rez commented Aug 19, 2024

I having the same issue with Vivaldi and Brave, something is broken, but it happens only to VP9 videos, AV01 are working fine, I haven't notice it until today.

I'm sure youtube dislike the extension and well, here we are XD.

The tab is freezing completely, hope it can be solve soon.

@kokon191
Copy link

If anyone's encountering the issue and is using a 1440p or 1080p monitor, can you post the URL here?

@vitorrm
Copy link
Author

vitorrm commented Aug 19, 2024

Not the same, but I did the following test:

I switch the resolution to 2560x1440 at 200% scale (recommended option from Windows) and the problem does happen, HOWEVER if I switch the scale to 100% the problem does NOT happen.

It also does not happen a lower resolutions like 1440x900, but for those resolutions the recommended scale is 100%.

Another test I did is to go back to 4k and set the scale to 100% (the default recommendation from Windows is 300% for 4k), and the problem DOES NOT happen at 100%, so it seems that it has something to do with the resolution scale on Windows

@shibotto
Copy link

Help me understand if we are talking about the same thing. By carefully shrinking the window, I can somewhat trigger this at will. Most of the time though it triggers by itself due to the fact that I don't keep the browser full width, different videos have different buttons, like/dislike take more or less space, etc.

Here's a video:

freeze_1.mp4

@vitorrm
Copy link
Author

vitorrm commented Aug 19, 2024

@shibotto For me the problem happen just by opening the video on maximized browser tab at the mentioned resolution X scale, there is no need to resize the browser window for the problem to happen, in my case. Although the behavior of the frozen page is the same.
Just to be clear, when I say "scale", I mean this Windows's configuration:
image

@Rhyzak
Copy link

Rhyzak commented Aug 20, 2024

I've also been having the same issue for a few days now, but I only just now figured out it was this extension.

I went through many violentmonkey scripts tryna figure out maybe it was one of my scripts, but everything worked fine after disabling this extension. I re-enabled the extension and it started freezing the video and entire page again.

I can't figure out what causes it either since everytime I open the console, everything works perfectly fine again.

EDIT: Come to think of it, maybe it has something todo with the position of the Like/Dislike buttons overlapping with some of the UI, since opening the console for me puts everything into a correct position. Where as the default youtube layout clips through each other when I resize the window to 1078x799.

@jvschiavo
Copy link

I have the same problem on Debian. Screen resolution of 720p. I keep zooming the pages in and out all the time for reading purposes.

@frapox
Copy link

frapox commented Aug 20, 2024

Same problem here. Firefox 129.0.2, Windows 11 23H2, extension version 3.0.0.16.
Example video: https://www.youtube.com/watch?v=YDDkCiUhHCc
youtube Firefox's subprocess goes to 200% and more CPU utilization and become freezed.

@Pixel48
Copy link

Pixel48 commented Aug 21, 2024

Checked in firefox proc monitor - when enabled youtube pages' CPU usage goes through the roof

So... I've profiled this

Youtube starts recompiling styles like crazy. Looks like one of the website scripts starts to behave like a fork bomb when touched
image

You can clearly spot exact moment when I've enabled addon. Will look through desktop-polymer.js when got some time

@ShinyNT
Copy link

ShinyNT commented Aug 21, 2024

it's freezing for me in this video too: https://www.youtube.com/watch?v=6o47N-aYd08 (if that helps)
comments don't even load, player freezes and cpu usage raises a lot

@marochmielo
Copy link

marochmielo commented Aug 21, 2024

The same problem for me on chrome. Freezes on the video mentioned above.
Version 127.0.6533.120 (Official Build) (arm64) macobbk air m1 macos 14.6.1
Exatctly the same on newest firefox.

Here is a screenshot of weird ui on the page
image

@kokon191
Copy link

Managed to consistently recreate the problem but I likely won't look deep into the root cause since the problem doesn't impact me with my use case (userscript version, extremely aggressive uBo filtering with almost all components hidden). Very likely to be a similar problem to #846

@adeptusgb
Copy link

This is happening to me but ONLY when the video is playing on the second monitor. Main monitor is 1920x1080 and second monitor is 1366x768 (Firefox/130.0b9, Windows 10)

@WesselKroos
Copy link

WesselKroos commented Aug 24, 2024

Update: I was able to break the infinite loop (freeze) by hiding the dislike counter text with a display: none:

<div class="yt-spec-button-shape-next__button-text-content" style="
  display: none;
">28</div>

It looks like YouTube is calculating the width of the like-dislike-buttons without taking the dislike button text's width into account. So this is not a complete fix for the dislike extension. But you can, untill this is fixed by the extension, overlay the dislike counter text on top of the dislike button's icon instead to prevent this infinite loop from happening, via this stylesheet:

.YtDislikeButtonViewModelHost .yt-spec-button-shape-next__button-text-content {
    position: absolute;
    left: 1px;
    top: 1px;
    right: 0px;
    bottom: 1px;
    backdrop-filter: blur(4px);
    border-radius: 99px;
}

It will look like this instead:
image


Original post:

I was lucky to get the infinite loop/freeze while DevTools was open and managed to find the infinite loop that randomly happens. I've created a custom userscript that delays the infinite loop by 1 second when it loops 10 times in a second and displays a red overlay with the amount of loops. This way I can prevent the browser tab from freezing and open DevTools when it happens again.
Apparently YouTube is continuously resizing the toolbar because it thinks it can fit more buttons into it.
Here is a screenrecording:

Screen.Recording.2024-08-25.001904.mp4

Here is the call stack of the infinite loop:
image

It seems to loop because the ytd-menu-renderer element has a scrollHeight (80) that is higher than the #top-level-buttons-computed scrollHeight (62) + 8. It then adds buttons to the toolbar, triggers a new calculation, removes some buttons from the toolbar, triggers a new calculation, etc...
image

I suspect the like/dislike ratio line or dislike counter increases the available height in the toolbar. So there might be some css changes necessary to prevent this loop.

@uniquoo
Copy link

uniquoo commented Aug 25, 2024

I encountered the same problem. After figuring out its this plugin it was evident. Firefox freezes on several occasions completely, using 100% CPU and leaking ram (ram is increasing limitless).

One video i was able to reproduce this behavior on was https://www.youtube.com/watch?v=0HwUGaYjlVk

@P4tr1kz
Copy link

P4tr1kz commented Aug 25, 2024

Same problem. Chrome browser latest release version. I disabled all extensions and enabled one by one. It is definitely the one causing the bug. Not on all videos, I noticed that it almost always freezes long videos (about an hour or more), short ones open normally.
But the bug only appears on the second 1080p 60Hz monitor turned to portrait mode.
If I drag a tab from the main 1440p 165Hz monitor directly from the tab bar, it also freezes, but if I open it in a new window and then drag it to the second one, everything works fine.

Also, the frozen tab starts to consume an abnormal amount of computer resources. It loads R7 5700x by 20% and slowly increases RAM consumption if i don't close it, the most I've seen is a little more than 6GB

@Anarios
Copy link
Owner

Anarios commented Aug 25, 2024

I'm stably reproducing it with scale set to 150% and long format of the dislikes.

From my observations - it's much easier to reproduce if the long format of dislikes is enabled. I.e. the width of the dislike button plays the role.

Disabling the percentage bar at bottom doesn't affect the bug at all.

The workaround by @WesselKroos doesn't work for the extension, because document.querySelectorAll("ytd-menu-renderer")[0].polymerController is not accessible to the extension content script.

To those affected - you might experience less problems if you disable the long format of likes\dislikes.

I will be looking for solution

image image

@Anarios
Copy link
Owner

Anarios commented Aug 25, 2024

The worst thing is that the code that crashes is YT code, not the extension code....

Anarios added a commit that referenced this issue Aug 26, 2024
#846 - Infinite Recursion on Some Video
@Anarios
Copy link
Owner

Anarios commented Aug 26, 2024

I've used @WesselKroos's idea and also added hiding of all "optional" menu items if the loop is detected with

ytdMenuRenderer.polymerController.flexAsTopLevelButtons = [];

The fix is submitted to chrome and FF stores under version 3.0.0.17

@Anarios
Copy link
Owner

Anarios commented Aug 27, 2024

@vitorrm @P4tr1kz @marochmielo @BlexToGo chrome fix is in the store, please let me know if it worked for you.

@P4tr1kz
Copy link

P4tr1kz commented Aug 27, 2024

@vitorrm @P4tr1kz @marochmielo @BlexToGo chrome fix is in the store, please let me know if it worked for you.

Fix worked. Thanks.

@vitorrm
Copy link
Author

vitorrm commented Aug 27, 2024

@vitorrm @P4tr1kz @marochmielo @BlexToGo chrome fix is in the store, please let me know if it worked for you.

Fix worked for me too, tks

@frapox
Copy link

frapox commented Aug 28, 2024

I've used @WesselKroos's idea and also added hiding of all "optional" menu items if the loop is detected with

ytdMenuRenderer.polymerController.flexAsTopLevelButtons = [];

The fix is submitted to chrome and FF stores under version 3.0.0.17

On the Mozilla store there is still the 3.0.0.16 version.

@ZhengZhaoxi
Copy link

ZhengZhaoxi commented Aug 29, 2024

@vitorrm @P4tr1kz @marochmielo @BlexToGo chrome fix is in the store, please let me know if it worked for you.Chrome Fix 在商店中,请让我知道它是否适合您。

the issue still happen,it still freezing in edge

@Anarios
Copy link
Owner

Anarios commented Aug 29, 2024

@ZhengZhaoxi did you update to 3.0.0.17?

@ZhengZhaoxi
Copy link

@ZhengZhaoxi did you update to 3.0.0.17?您是否更新到 3.0.0.17?

yes,I uninstalled and reinstalled many times

@jvschiavo
Copy link

@ZhengZhaoxi did you update to 3.0.0.17?您是否更新到 3.0.0.17?

yes,I uninstalled and reinstalled many times

Other people here are not having the problem anymore.

Please provide more details, like Operating System and version, browser version, resolution of your screen, zoom applied on the page, etc.

@Rhyzak
Copy link

Rhyzak commented Aug 30, 2024

it's working great for me as well since the update, no issues here so far

@shibotto
Copy link

shibotto commented Aug 30, 2024

Still broken for me too, although it's harder to trigger. See the "Save" button looping when manually advancing in the debugger:

2024-08-30.11-56-44_1.mp4

@Anarios Anarios reopened this Aug 30, 2024
@ScorelessPine
Copy link

I've recently been having this issue as well but while I can't pin down the exact cause, I have a hunch my issue could be related to some tests YouTube are trying with disabling the Like count on some newer videos. For me, I'm having the entire tab freeze when I try to load this video by Mark Rober, which seems to have a hidden like count. I was tipped off to this change being tested from a reddit post on r/YouTube from about 5 hours ago, and as far as I can tell this issue is not occurring on any other videos I try that have a visible Like count. This is not the only extension I've found that is having issues, however, as I've also run into the same "xyz extension is slowing down Firefox" message with "Channel Blocker" and "Hide shorts for YouTube".

Checking out the process manager when this happens seems to indicate it's a similar looping script issue, as it shows the affected tab as quickly growing in RAM usage, up to 1GB almost immediately, and consistently taking up 99-100% of Firefox's CPU usage until the tab process is killed.

@ScorelessPine
Copy link

I want to make an amendment to my comment from a few days ago, the linked video from Mark Rober now seems to have Likes enabled again and I once again am having no issues with the extensions I mentioned before, meanwhile now when I check another video (Game Grumps fan compilation video here) that has likes/dislikes disabled by the video owner, I get the exact same issue I mentioned before, which makes me even more certain it has something to do with the disabled like count causing multiple extension scripts to fail.

@Kadah
Copy link

Kadah commented Nov 9, 2024

Been getting this starting with some Firefox updates last month. As of 132, it seems to affect most videos randomly. This video was doing it every page load till just now while writing this and checking it again.

I already had the perfect bar turned off.

Xubuntu 22.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests