Anarios / return-youtube-dislike

Chrome extension to return youtube dislikes
https://returnyoutubedislike.com/
GNU General Public License v3.0
12.5k stars 557 forks source link

Extension is freezing some Youtube pages #1074

Open vitorrm opened 1 month ago

vitorrm commented 1 month ago

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

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

bottleblue commented 1 month ago

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 commented 1 month ago

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

Sahil12524 commented 4 weeks ago

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

BlexToGo commented 4 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

It seems to me that it's struggling a lot to relocate the buttons next to :+1: :-1: .

kokon191 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

@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 commented 3 weeks ago

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

Alf3rez commented 3 weeks ago

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 commented 3 weeks ago

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

vitorrm commented 3 weeks ago

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 commented 3 weeks ago

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:

https://github.com/user-attachments/assets/332f5718-f0f8-4463-950a-d5ee7f826e9c

vitorrm commented 3 weeks ago

@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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 https://github.com/Anarios/return-youtube-dislike/issues/846

adeptusgb commented 3 weeks ago

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 commented 3 weeks ago

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:

https://github.com/user-attachments/assets/6b0783a7-ac1c-4047-a20b-b50c51cce7a9

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 commented 3 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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

Anarios commented 2 weeks ago

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 commented 2 weeks ago

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

P4tr1kz commented 2 weeks ago

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

Fix worked. Thanks.

vitorrm commented 2 weeks ago

@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 commented 2 weeks ago

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 commented 2 weeks ago

@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 commented 2 weeks ago

@ZhengZhaoxi did you update to 3.0.0.17?

ZhengZhaoxi commented 2 weeks ago

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

yes,I uninstalled and reinstalled many times

jvschiavo commented 2 weeks ago

@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 commented 2 weeks ago

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

shibotto commented 2 weeks ago

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

https://github.com/user-attachments/assets/85396fab-1f20-4b57-bfe7-f3fa2fd4ed9e