Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Aug 25, 2025

Sequentialize uncaught exceptions in Node.js Workers into the same postMessage() stream that other messages go through, to ensure they are received by the main thread in the order they were generated.

Fixes #15014.

See nodejs/node#59617.

@juj juj force-pushed the fix_flaky_test_pthread_abort branch 2 times, most recently from 848ca23 to f422942 Compare August 25, 2025 10:02
…stMessage() stream that other messages go through, to ensure they are received by the main thread in the order they were generated. Fixes emscripten-core#15014. See nodejs/node#59617

Ruff
@juj juj force-pushed the fix_flaky_test_pthread_abort branch from f422942 to cefd3ed Compare August 25, 2025 11:13
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.

So if I'm understanding correctly, issue is with the onAbort handler, which is being called via the callHandler message is racing with the onerror handler for uncaught exceptions?

Nice work find this!

@juj
Copy link
Collaborator Author

juj commented Aug 25, 2025

So if I'm understanding correctly, issue is with the onAbort handler, which is being called via the callHandler message is racing with the onerror handler for uncaught exceptions?

Nice work find this!

Thanks - that looks like the case. For some reason Node.js internally uses a different mechanism to propagate postMessage()s vs process.on('uncaughtError')s from Worker to parent.

@juj juj enabled auto-merge (squash) August 25, 2025 19:06
@juj juj force-pushed the fix_flaky_test_pthread_abort branch from a839349 to 43e00dd Compare August 25, 2025 19:49
@juj juj disabled auto-merge August 25, 2025 23:35
@juj juj merged commit 20dd010 into emscripten-core:main Aug 25, 2025
28 of 30 checks passed
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.

test_pthread_abort is failing on macOS & flaky on linux

2 participants