Fix flakiness in test_itimer_proxy_to_pthread - #27789
Merged
Merged
Conversation
Calling `printf` in these signal handlers was causing issues since it requires taking the stdio lock which in turn can run more proxied work (signal handler all run on the main thread). Fixes: emscripten-core#20125
kripken
approved these changes
Sep 28, 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.
Followup to #27778.
Calling
printfin these signal handlers was causing issues since it requires taking the stdio lock which in turn can run more proxied work (signal handler all run on the main thread). In this case, the flake is caused by thesetitimerwhich cancels the timers running during the printf call (and before the counter is incremented), i.e. in the middle of the signal handler. This means that worker thread can observe the effect of the timer (the counter being incremented) after the timer is cancelled (because the cancellation effectively ran during the execution of the signal handler).Possible followups to avoid this type of thing in the future:
Fixes: #20125