Skip to content

fix(YouTube): Always use single threaded layout to resolve layout bugs in unpatched YouTube #5226

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

Merged

Conversation

LisoUseInAIKyrios
Copy link
Contributor

@LisoUseInAIKyrios LisoUseInAIKyrios commented Jun 22, 2025

This change fixes an issue where the You tab watch history or playlist shelf is incorrectly set hidden (it's not ReVanced that is incorrectly hiding the shelves).

This might also fix a known issue in unpatched YouTube, where if a comment is made in the video player then the app starts consuming a lot of battery life until the app is force closed or fully restarted.

@0xrxL

This comment was marked as off-topic.

@LisoUseInAIKyrios

This comment was marked as off-topic.

@0xrxL

This comment was marked as off-topic.

@LisoUseInAIKyrios

This comment was marked as off-topic.

@oSumAtrIX
Copy link
Member

I don't understand how changing threads count solve the issue. Why would multiple threads cause a leak and one not?

@0xrxL
Copy link

0xrxL commented Jun 22, 2025

I don't understand how changing threads count solve the issue. Why would multiple threads cause a leak and one not?

Good question. Reducing threads amount fixed playlist hiding issue too.

@LisoUseInAIKyrios
Copy link
Contributor Author

It's not yet confirmed if this fixes the memory leak issue with the player comment box.

But if this does fix it, it likely is a thread contention/race issue where data is corrupted by interleaved thread calls.

The watch history incorrectly hiding is almost certainly the same or similar issue. This PR definitely fixes that because it's easy to verify the issue is present with/without this change.

@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Jun 22, 2025

Technically it's not a memory leak, as the memory is getting cleared out as evident by the excessive garbage collection log messages. A true memory leak would cause the app to eventually crash with OOM exception, and that's not happening.

I think it's some intermediate objects or an internal state becomes corrupted by multiple threads modifying the same data. And then that corrupted intermediate object/state is continually rebuilt/recalculated/whatever which causes a high memory usage and high CPU usage.

@LisoUseInAIKyrios LisoUseInAIKyrios linked an issue Jun 22, 2025 that may be closed by this pull request
3 tasks
@LisoUseInAIKyrios LisoUseInAIKyrios changed the title fix(YouTube): Always use single threaded layout to resolve layout and memory bugs found in unpatched YouTube fix(YouTube): Always use single threaded layout to resolve layout bugs in unpatched YouTube Jun 22, 2025
@WilliamTael
Copy link

Forces layout thread pool to always use 1 thread (instead of 1/2/3 threads).

This change fixes an issue where the You tab watch history or playlist shelf is incorrectly set hidden (it's not ReVanced that is incorrectly hiding the shelves).

This might also fix a known issue in unpatched YouTube, where if a comment is made in the video player then the app starts consuming a lot of battery life until the app is force closed or fully restarted.

Anyone who can reproduce the comment issue described above is encouraged to try patching with this pull request and verify if the issue is fixed or not fixed. You can patch using CLI tools and the artifact created by this pull request.

How do I apply this patch? I'm just a Revanced user, don't know how to code.

@LisoUseInAIKyrios
Copy link
Contributor Author

LisoUseInAIKyrios commented Jun 23, 2025

You can patch using CLI tools and the artifact created by this pull request.

How do I apply this patch? I'm just a Revanced user, don't know how to code.

You'll need to patch using a computer and CLI tools as the first post describes. If you're not familiar or don't want to figure out then you'll need to wait until this is merged into the regular release. If you need further help visit the discord or Reddit support links, GitHub is not for troubleshooting.

@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 1f539b1 into ReVanced:dev Jun 23, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Jun 23, 2025
# [5.29.0-dev.1](v5.28.1-dev.2...v5.29.0-dev.1) (2025-06-23)

### Bug Fixes

* **YouTube:** Always use single threaded layout to resolve layout bugs in unpatched YouTube ([#5226](#5226)) ([1f539b1](1f539b1))

### Features

* **YouTube:** Add an option to disable toasts when changing default playback speed or quality ([#5230](#5230)) ([c68cde3](c68cde3))
github-actions bot pushed a commit that referenced this pull request Jun 26, 2025
# [5.29.0](v5.28.0...v5.29.0) (2025-06-26)

### Bug Fixes

* Add scrollable content to modern style settings dialogs ([#5211](#5211)) ([e6876d5](e6876d5))
* **Google Photos:** Resolve startup crash for Android 5.0 devices ([0294533](0294533))
* **YouTube - Hide ads:** Hide new type of product ad in video description ([#5225](#5225)) ([1e2efad](1e2efad))
* **YouTube - Hide layout components:** Fix "Hide video description attributes" ([#5250](#5250)) ([2f22d45](2f22d45))
* **YouTube - Hide Shorts components:** Fix "Hide Use this sound button" ([#5233](#5233)) ([5d6ec9e](5d6ec9e))
* **YouTube - Hide Shorts components:** Fix "Hide Use this template button" ([#5249](#5249)) ([b399ecb](b399ecb))
* **YouTube:** Always use single threaded layout to resolve layout bugs in unpatched YouTube ([#5226](#5226)) ([1f539b1](1f539b1))
* **YouTube:** Fix refactoring app startup exception ([1b00c90](1b00c90))

### Features

* Add `Spoof app signature` patch ([#5158](#5158)) ([78b25aa](78b25aa))
* **Cricbuzz:** Add `Hide ads` patch ([#4998](#4998)) ([83ccfa8](83ccfa8))
* **Crunchyroll:** Add `Hide ads` patch ([#5201](#5201)) ([46b4398](46b4398))
* **YouTube - Hide Shorts components:** Add `Hide Effects button` ([#5255](#5255)) ([240897a](240897a))
* **YouTube - Hide video action buttons:** Add `Hide Stop ads` ([#5245](#5245)) ([274dcc6](274dcc6))
* **YouTube:** Add an option to disable toasts when changing default playback speed or quality ([#5230](#5230)) ([c68cde3](c68cde3))
* **YouTube:** Support version `20.13.41` ([#5253](#5253)) ([d284c3d](d284c3d))
@LisoUseInAIKyrios LisoUseInAIKyrios deleted the fix/litho_thread_pool_size branch June 26, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants