Skip to content

test: bound prefetch cleanup waits for saturated corpus runs - #4233

Merged
Sinity merged 1 commit into
masterfrom
fix/prefetch-timeout
Aug 26, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/prefetch-timeout

Conversation

@Sinity

@Sinity Sinity commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the load-sensitivity that failed test_submit_failure_cleans_every_admitted_future_and_reservation in corpus runs 2 and 5 while passing at every lighter scope.

Problem (evidence)

The test bounds its executor-thread startup wait at 2s and its idle/release waits at 5s. A full-corpus run executes 3 pytest processes × 8 xdist workers on this host, and under that saturation thread scheduling can exceed 2s — the test failed only in full-corpus runs (2b00a953, 215385b4) and passed focused, at file scope, and in three consecutive daemon-directory runs. The timeouts exist to bound a genuinely hung test, not to assert scheduling latency.

Solution

Waits widened to 30s (start, release, idle). The protected invariant — a mid-batch submit failure strands no futures or byte reservations — is asserted unchanged; a real hang still fails within the bound.

Verification

  • devtools test tests/unit/daemon/test_parse_prefetch.py → 23 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1cf9d0e0-edec-4fa3-a2ec-9ac0b07b9d56


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 5099a3c into master Aug 26, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the fix/prefetch-timeout branch August 26, 2026 09:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 267a2aeb94

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sinity added a commit that referenced this pull request Aug 26, 2026
…4234)

## Summary
Fixes the parse-stage lifecycle race that failed
`test_submit_failure_cleans_every_admitted_future_and_reservation` in
corpus runs 2, 5, and 6 while passing at every lighter scope.

## Problem (evidence)
`CensusParseStage._refresh_lifecycle_state_locked` published
`_warm_idle.set()` **before** `_writer_admission_ready.set()`.
`wait_until_idle` returns the instant the first event is set, so a
caller thread can read `writer_admission_ready()` in the two-instruction
window before the second — exactly the corpus run 6 failure
(`wait_until_idle(30)` True, then `assert
stage.writer_admission_ready()` False; receipt `cf7379a5`, worker gw5,
first test on the worker so no cross-test pollution). Under the
free-threaded 3.14t build at full-corpus contention this interleaving is
realistic; run 6's receipt ruled out the earlier load-latency theory
(#4233 widened waits and it still failed).

## Solution
Set the dependent gate first and the wake signal last in the refresh
path, with the mirrored order in `_begin_warm_operation`'s clear path so
no reader can observe idle cleared while admission is still open.
Stop-requested semantics unchanged.

## Verification
- `devtools test tests/unit/daemon/test_parse_prefetch.py
tests/unit/sources/test_live_batch_support.py` → 166 passed.
- `devtools verify --quick` → all 15 gates ok.
- The race itself is only observable under corpus-scale contention;
corpus run 7 after merge is the decisive check.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant