Bug 248224 - [GTK] YouTube player is unresponsive, extremely slow scrolling on pages with video
Summary: [GTK] YouTube player is unresponsive, extremely slow scrolling on pages with ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 249926 (view as bug list)
Depends on:
Blocks: GLibPerformance
  Show dependency treegraph
 
Reported: 2022-11-22 06:36 PST by Kdwk
Modified: 2024-05-14 21:05 PDT (History)
7 users (show)

See Also:


Attachments
Capture of Epiphany refusing to load YouTube when there's Sysprof looking over its shoulder, with memory allocations (28.25 MB, application/zip)
2023-02-20 18:50 PST, Kdwk
no flags Details
Sysprof capture of YouTube player page in Epiphany (573.34 MB, application/octet-stream)
2023-02-25 18:11 PST, Kdwk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kdwk 2022-11-22 06:36:44 PST
Around WebKitGTK 2.38.1/2, YouTube player pages are practically completely unresponsive, with each input taking seconds to be processed and scrolling only happening once every few seconds. This unresponsiveness does not occur on the YouTube main page nor during inline playback on the YouTube main page. It also does not occur with embedded YouTube players or other videos.
Comment 1 Michael Catanzaro 2022-12-22 05:51:41 PST
Can't reproduce this.
Comment 2 Kdwk 2022-12-27 20:33:32 PST
Update: after some testing, I have found all MiniBrowsers, including the one from manually building org.gnome.Platform, doesn't freeze up on the YouTube player page.
Comment 3 Kdwk 2022-12-28 20:04:54 PST
Update: another user is able to reproduce the issue: https://bugs.webkit.org/show_bug.cgi?id=249926
Comment 4 Michael Catanzaro 2022-12-29 06:57:36 PST
*** Bug 249926 has been marked as a duplicate of this bug. ***
Comment 5 Michael Catanzaro 2022-12-29 06:58:56 PST
(In reply to kdwkleung from comment #2)
> Update: after some testing, I have found all MiniBrowsers, including the one
> from manually building org.gnome.Platform, doesn't freeze up on the YouTube
> player page.

What happens if you run MiniBrowser with WEBKIT_FORCE_SANDBOX=1?
Comment 6 Carlos Garcia Campos 2022-12-29 07:23:54 PST
(In reply to Michael Catanzaro from comment #5)
> (In reply to kdwkleung from comment #2)
> > Update: after some testing, I have found all MiniBrowsers, including the one
> > from manually building org.gnome.Platform, doesn't freeze up on the YouTube
> > player page.
> 
> What happens if you run MiniBrowser with WEBKIT_FORCE_SANDBOX=1?

Even better MiniBrowser --enable-sandbox. I think he already tried and problem was still there. He also tried disabling the adblocker in ephy, which might be another difference between ephy and MB, but no luck either.
Comment 7 Sergio Villar Senin 2022-12-29 09:22:52 PST
(In reply to Carlos Garcia Campos from comment #6)
> (In reply to Michael Catanzaro from comment #5)
> > (In reply to kdwkleung from comment #2)
> > > Update: after some testing, I have found all MiniBrowsers, including the one
> > > from manually building org.gnome.Platform, doesn't freeze up on the YouTube
> > > player page.
> > 
> > What happens if you run MiniBrowser with WEBKIT_FORCE_SANDBOX=1?
> 
> Even better MiniBrowser --enable-sandbox. I think he already tried and
> problem was still there. He also tried disabling the adblocker in ephy,
> which might be another difference between ephy and MB, but no luck either.

I've just tried with MB distributed in the Debian package and I got the very same result, the page freezes when trying to scroll.
Comment 8 Kdwk 2023-01-23 07:33:17 PST
Ambient Mode (YouTube -> turn on Dark Mode -> open a video -> video settings -> Ambient Mode) apparently makes this worse, although without Ambient Mode YouTube is already unusable enough.
Comment 9 Kdwk 2023-01-23 07:33:49 PST
Ambient Mode (YouTube -> turn on Dark Mode -> open a video -> video settings -> Ambient Mode) apparently makes this worse, although without Ambient Mode YouTube is already unusable enough.
Comment 10 Kdwk 2023-01-31 02:56:22 PST
I've acquired a new machine, and YouTube didn't freeze the first time I visited the site on the machine. After that, it always freezes, even after I deleted the entire mesa_shader_cache folder.
Comment 11 Kdwk 2023-01-31 05:59:46 PST
I'm pretty sure the comments section is to blame. I just opened a YouTube video again and the comments section failed to appear for some reason. The page was smooth and did not freeze.
Comment 12 Kdwk 2023-02-20 18:50:58 PST
Created attachment 465100 [details]
Capture of Epiphany refusing to load YouTube when there's Sysprof looking over its shoulder, with memory allocations

I was advised to do a Sysprof capture of YouTube player being unresponsive, but YouTube doesn't load whenever Sysprof is recording, so here's the Sysprof capture of that instead.
Comment 13 Kdwk 2023-02-25 18:11:50 PST
Created attachment 465179 [details]
Sysprof capture of YouTube player page in Epiphany

I finally got a YouTube player page to load while being recorded by Sysprof. Here's the syscap of me trying to scroll on the YouTube player page.
Comment 14 Kdwk 2023-03-17 08:06:09 PDT
I have new progress in investigating why YouTube player pages freeze when I'm logged in to Google but not when I'm logged out...

When I'm logged in and open a player page, the console always have this line of error: `[Error] Failed to load resource: Error reading data from TLS socket: An unexpected TLS packet was received. (generate_204, line 0)`

While player page when not logged in (in Incognito mode) would not have this error. Incognito mode, logged in, would have this error too.

The curl request is for the resource (taken from Web Inspector -> Network):

curl 'https://rr2---sn-ibj-i3be6.googlevideo.com/generate_204' \
-X 'GET' \
-H 'Accept: image/webp,image/avif,video/*;q=0.8,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5' \
-H 'Referer: https://www.youtube.com/' \
-H 'Sec-Fetch-Dest: image' \
-H 'Sec-Fetch-Mode: no-cors' \
-H 'Sec-Fetch-Site: cross-site' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Safari/605.1.15'
Comment 15 Kdwk 2023-03-26 08:07:43 PDT
Another discovery:

When installed as a web app, YouTube doesn't freeze even when logged in.
Comment 16 scottjeffers4 2023-10-08 09:46:03 PDT
still slow
Comment 17 Kdwk 2024-05-14 21:05:16 PDT
Fixed with Skia (WebKitGTK 2.45.x)