Skip to content

Conversation

brendandahl
Copy link
Collaborator

The audio worklet was still running after emscripten had exited. This caused the browser to hang intermittently.

The audio worklet was still running after emscripten had exited. This
caused the browser to hang intermittently.
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.. but should this happen automatically somehow?

@sbc100
Copy link
Collaborator

sbc100 commented Sep 18, 2025

ruff checks are fixed in main already

@cwoffenden
Copy link
Contributor

Are you able to reproduce this locally or only on CI?

@juj
Copy link
Collaborator

juj commented Sep 19, 2025

Should this be a documented requirement for Emscripten developers that utilize AudioWorklet? I.e. do their web pages risk hanging (in Chrome?) if they do not close the worklet before closing the page?

@cwoffenden
Copy link
Contributor

Should this be a documented requirement for Emscripten developers that utilize AudioWorklet?

I wonder if it's specific to how the test works? We don't see this in production (with millions of Chromebook users on the worst school hardware).

@juj
Copy link
Collaborator

juj commented Sep 19, 2025

That sounds great. (Chrome CI tests should run on Chromebooks then? =)

Would be good to be able to capture what it is with this specific test, though ok to land this as a fix.

@juj juj merged commit 9a85562 into emscripten-core:main Sep 19, 2025
16 of 31 checks passed
@brendandahl
Copy link
Collaborator Author

Are you able to reproduce this locally or only on CI?

Locally with EMTEST_BROWSER="taskset -c 0 google-chrome-unstable". I can also reproduce a hang intest_audio_worklet_* and a similar fix there seems to work. As far as I can tell, there's no extra wasm or audio worklet code running after force_exit, so it seems like this may be a bug in chrome. I'm hoping we can maybe put together a smaller reproducer and file a bug.

@brendandahl
Copy link
Collaborator Author

lgtm.. but should this happen automatically somehow?

Do we handle cleanup on emscripten_force_exit automatically in other cases? It seems any emscripten_create_audio_context should be paired with a emscripten_destroy_audio_context by the user.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 19, 2025

lgtm.. but should this happen automatically somehow?

Do we handle cleanup on emscripten_force_exit automatically in other cases? It seems any emscripten_create_audio_context should be paired with a emscripten_destroy_audio_context by the user.

We do shutdown pthreads automatically on exit, so it seems reasonable that we should shut down all the audio worklets too.

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

Successfully merging this pull request may close these issues.

4 participants