Repository navigation
test: keep interpreter start-up out of the early-exit pattern-judge budget (SR-6) - #326
Draft
jothimani-rajendran wants to merge 1 commit into
Draft
jothimani-rajendran wants to merge 1 commit into
jothimani-rajendran wants to merge 1 commit into
Conversation
…udget (SR-6)
judge_patterns spends interpreter start-up out of the caller's budget when it
starts a child. The dead-child test gave those calls the 1 s budget meant for
the catastrophic pattern, so on a loaded runner the fresh child after the
timeout was not up in time and the "(" case reported "no verdict within 1s"
instead of "exited early". The calls that start a child now get
PATTERN_SECONDS; the catastrophic pattern keeps the 1 s budget on an
already-running child. No assertion changed. budget.py and the vendored
runtime are untouched.
Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
This branch has not been 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.
What
test_the_judge_matches_times_out_and_reports_a_dead_childfailed once on a CI runner (3.12) withthe patterns gave no verdict within 1swhere it expectsthe pattern judge exited early (; it passed on re-run of the same commit.Why
judge_patternsstarts a child on demand and the caller's budget includes that child's interpreter start-up. After the catastrophic-pattern step kills the child, the next call ("(") starts a fresh one. With a 1 s budget, a loaded runner can still be starting it when the budget runs out, so the early exit is never seen.budget.pyalready reports an exited child at once (EOF on the pipe); the delay was start-up, not detection.Change
tests/test_pattern_deadline.pyonly. The three calls that start a child (first match, the"("case, the new child after the crash) getbudget.PATTERN_SECONDS; they return as soon as the child answers or dies, so the test is not slower. The catastrophic-pattern step keeps the 1 s budget, on a child that is already up. No assertion changed; nothing skipped, retried or marked flaky.src/chock/gate/budget.pyis untouched, so the vendored runtime (.chock/bin, runtime goldens) does not change and needs no owner sync.Evidence
Race reproduced by running the real test with
sys.executablepointed at a wrapper that sleeps 1.5 s before exec'ing Python (a slow child start):1 failed((None, 'the patterns gave no verdict within 1s ...')where a verdict was expected)1 passed8 passedintests/test_pattern_deadline.py;ruff checkandruff format --checkclean.CPU-load reproduction (24 busy loops on 4 cores, 15 runs): 0 failures before the fix, so the slow-start wrapper is the reproduction.
No changelog fragment: test-only.