Repository navigation
[esm-integration] Sequentialize uncaught exceptions in Node.js workers - #27854
Merged
sbc100 merged 1 commit intoOct 2, 2026
Merged
Conversation
In emscripten-core#25041, uncaught exceptions in Node.js worker threads were captured and sequentialized over the `postMessage` pipe to resolve a race condition where Node.js delivers worker uncaught exception events before earlier `postMessage`s (such as proxied `onAbort` handlers). That change fixed emscripten-core#15014 for non-ESM builds. However, that workaround in `src/runtime_common.js` was omitted under `-sWASM_ESM_INTEGRATION` because worker threads bootstrap via `src/pthread_esm_startup.mjs` instead. As a result, `test_pthread_abort` remained flaky under `esm_integration`. This installs the same `process.on('uncaughtException')` handler in `src/pthread_esm_startup.mjs` and removes the `@flaky` annotation from `test_pthread_abort`. See: emscripten-core#15014 Fixes: emscripten-core#25151
kripken
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #25041, uncaught exceptions in Node.js worker threads were captured and sequentialized over the
postMessagepipe to resolve a race condition where Node.js delivers worker uncaught exception events before earlierpostMessages (such as proxiedonAborthandlers). That change fixed #15014 for non-ESM builds.However, that workaround in
src/runtime_common.jswas omitted under-sWASM_ESM_INTEGRATIONbecause worker threads bootstrap viasrc/pthread_esm_startup.mjsinstead. As a result,test_pthread_abortremained flaky underesm_integration.This installs the same
process.on('uncaughtException')handler insrc/pthread_esm_startup.mjsand removes the@flakyannotation fromtest_pthread_abort.See: #15014
Fixes: #25151