Repository navigation
test(core): remove readiness race in AppProcess interruption tests - #51952
Closed
saulalfonsos wants to merge 3 commits into
Closed
saulalfonsos wants to merge 3 commits into
saulalfonsos wants to merge 3 commits into
Conversation
The child process in the two interruption tests wrote its `ready` file before installing its SIGTERM handler, and wrote it with writeFileSync, which creates the file empty before filling it. On a loaded machine the test could read `ready` as empty (`Received: ""`) or send SIGTERM before the handler existed, so the child died without writing `settled`. The child now installs the handler first and publishes both files atomically (write to a temp file, then rename), in a shared helper. Measured with 16 runs of the file in parallel: 0 failures in 960 runs.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
5 of 6 tasks
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.
Issue for this PR
Closes #51951
Type of change
What does this PR do?
Test-only fix. The child process in the two AppProcess interruption tests announced it was ready before installing its SIGTERM handler, and wrote the
readyfile withwriteFileSync, which leaves an empty file for a moment. Under load the test read it empty or signalled too early.The child now registers the handler first and writes both marker files atomically (temp file + rename), via a small shared helper used by both tests. No production code changes.
How did you verify your code works?
Ran
bun test test/process/process.test.ts16 times in parallel for 60 rounds (960 runs): 0 failures with the fix. Before, the readiness failure showed up under the same load.bun typecheckinpackages/corepasses.Screenshots / recordings
N/A
Checklist