Skip to content

[Web] Fix Webkit leak caused by the position reporting audio worklets #107948

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

Conversation

adamscott
Copy link
Member

This PR reintroduces the pooling of GodotPositionReportingProcessor worklets. This is because Webkit doesn't seem to delete processors that return false in process(), even if the specs says to do so. That made the memory explode and the Webkit engine reloading the games.

This PR also removes the postMessage limit on audio position worklet. The tests made by @PizzaLovers007 seem to indicate that the partial reporting didn't achieve it's goals and was basically useless.

Here's my iPad Pro M3 running a tweaked version of the #107390 MRP for more than 18 minutes straight.

Audio Test 18m

At the 18 minutes mark, nothing seems to indicate that the MRP was taxing for my iPad, memory-wise nor processing-wise.

Capture d’écran, le 2025-06-24 à 14 31 37

MRP: audio-test.zip

Fixes #107390.
Fixes #105397.
Supersedes #105541. (added co-authorship)
Reverts the spirit of #102715.
Doesn't seem to create a regression for #102505.

Co-authored-by: PizzaLovers007 <trex@parkvue.com>
@adamscott adamscott added this to the 4.5 milestone Jun 24, 2025
@adamscott adamscott requested a review from a team as a code owner June 24, 2025 18:57
@adamscott
Copy link
Member Author

cc. @rburing @mooflu @PizzaLovers007

@mellowminx
Copy link

Thanks so much for this fix! 🥳

@Zireael07
Copy link
Contributor

So we're effectively going back and forth on those audio worklets :/

@akien-mga akien-mga merged commit 30456ba into godotengine:master Jun 25, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@adamscott
Copy link
Member Author

So we're effectively going back and forth on those audio worklets :/

I think this one is for good.

@mellowminx
Copy link

I excitedly downloaded Godot 4.5 beta 2 to test this fix, thank you so much! Working for me, tested for at least 30 mins each on iOS Chrome and iOS Safari. Test export is here: https://mellowminx.itch.io/audio-test-godot-45-beta2 (password: godot)

@Frozenfire92
Copy link
Contributor

Does this change require a recompile? I'm wondering if its possible to fix for 4.4.1

I tried copying the changes here in my two javascript files on my 4.4.1 export and it got further than before (and audio played), it still crashed/reloaded after about 30 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants