Fix race in OrderReporterTest#test_forking - #426
Merged
Merged
Conversation
`start` truncates the log file. The test forked `start` and the five `before_test` writers concurrently and only waited on all of them at the end, so the truncate could land after one or more appends and erase them. Seen on main (7074624): ruby-tests (4.0, ~> 5.11) got 4/5 lines back while two other runs of the same SHA passed. Wait for the `start` fork before spawning the writers. This matches production ordering (parent calls `start`, then workers fork) while still exercising the lazy per-worker `File.open` path the test exists for. Also drop `delete_log`: never called, and `File.exists?` was removed in Ruby 3.2. Assisted-By: devx/5182f76b-a2d3-465f-8030-398a21f6a485
markdorison
marked this pull request as ready for review
September 18, 2026 20:01
mdwn
approved these changes
Sep 18, 2026
This branch was successfully deployed
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.
starttruncates the log.test_forkingforkedstartand the fivebefore_testwriters concurrently and only waited at the end, so the truncate could land after an append and erase it. Seen on main at 7074624:ruby-tests (4.0, ~> 5.11)got 4 of 5 lines back (run) while two other runs of the same SHA passed.startfork before spawning writers. Matches production ordering (parent callsstart, then workers fork) and keeps the lazy per-workerFile.openpath under test.delete_log: never called, andFile.exists?was removed in Ruby 3.2.Verified on Ruby 4.0.7: with a 10ms delay injected into
start, the old test fails (+[], all lines lost) and the fixed test passes. Fixed file passes 10 of 10 runs.