Repository navigation
fix(test): bound race-round barrier spin so a missing release flag fails instead of hanging - #39
Open
danikdanik wants to merge 1 commit into
Open
danikdanik wants to merge 1 commit into
danikdanik wants to merge 1 commit into
Conversation
…ils instead of hanging _race_round held 10 forked racers on `while [ ! -f "$flag" ]; do :; done` with no bound. If the release flag can never appear — the mktemp workdir was swept mid-round, the flag create failed, or TMP was empty — each racer burns ~65% CPU forever while `wait` parks the suite. Observed: ~7 cores of busy-loop holding a conformance run for 16+ hours. Each racer now concedes when the workdir is gone or a 15s deadline hits, and a broken barrier returns a distinct ERR result so callers stop on the first broken round — 0 winners can no longer masquerade as a control catch, and a failed flag create kills the round's racers immediately instead of burning 40 rounds of deadline. Verified on bash 3.2.57/macOS: healthy run still 20/20 (~15s); deleting the workdir mid-race exits rc=1 in ~2s with 'release flag never appeared' instead of hanging.
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.
What
_race_round()intest_windows_portability.shheld 10 forked racers on an unbounded busy-spin (while [ ! -f "$flag" ]; do :; done). If the release flag can never appear — the mktemp workdir was swept mid-round,: > "$flag"failed, orTMPwas empty — every racer burns ~65% CPU forever whilewaitparks the suite.Why it matters
Observed on macOS (bash 3.2.57): a single conformance run parked for 16+ hours with ~7 cores of pure busy-loop, because
conformance.shinvokes suites with no timeout and the test has no bound of its own. The failure is silent — nothing in the output says the suite wedged.How
SECONDSdeadline hits — a broken barrier reportsFAILinstead of hanging._race_roundreturns a distinctERRon barrier failure (flag create fails, orwon/flagvanish mid-round), and both callers stop on the first broken round — no more 40×15s slow-burn on a persistent failure, and 0 winners can no longer masquerade as a "control caught non-atomic claim" pass.wait $pidsinstead of barewait;true >instead of: >so a redirect failure can't exit POSIX shells before||runs; entry guard for empty/missingTMP.Repro / verification
passed=20 failed=0in ~15s, control still catches 20/20.waitinS, 10 children at ~65% CPU inR, indefinitely.FAIL: race barrier broken — release flag never appeared (round N), suite exitsrc=1in ~2s.Residual (out of scope):
conformance.shstill has no per-suite timeout, so a suite that wedges outside a bounded spin can still park the gate — worth a follow-up.