Repository navigation
test: wait on real signals in two load-flaky tests - #3954
Merged
Merged
Conversation
prepared_generation_uses_bounded_parallelism_and_retained_bytes awaited only its demand tasks, then asserted that no page build was still active. A prefetch that waited on a demand build rebuilds its page when that page has already left the process-global cache, which concurrent tests in the suite binary cause. That rebuild was still running at the assertion (left: 1). The prefetch starter now returns its task handles alongside the abort handles, and the test joins every prefetch before asserting. Refs #3950
registered_persistence_failure_releases_only_after_join_and_writer_fence gave shutdown a 250 ms budget. The writer fence spends that budget waiting for the test to commit its held writer, which the test does only after it observes the worker join. When the test task was scheduled late, the fence timed out, shutdown returned observability_shutdown_deadline, and the producer stayed joined but not settled. Production ordering is correct: settled is stored only after the worker join and a completed fence. The test now gives shutdown a 30 s budget so the fence ends on the writer release, and drops the pre-shutdown sleep that only kept the worker reply inside the old budget. Refs #3950
|
ScriptedAlchemy
enabled auto-merge
October 14, 2026 17:15
Contributor
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
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.
Two tests failed under host load and passed alone. Both are test races. Production ordering is correct in both cases. Each test now waits on the signal that ends the work it checks.
prepared_generation_uses_bounded_parallelism_and_retained_bytesRoot cause. The test starts a prefetch for every path and then spawns a demand task for every path. It awaited only the demand tasks before it asserted
observed_builds.active() == 0. A prefetch that waits on a demand build loops back to the process-global page cache when that build finishes. If the page has already left the cache, the prefetch builds the page again. The test does not wait for that rebuild, so it was still running at the assertion (left: 1, right: 0attests.rs:710).Why the #2811 fix stopped holding. #2852 and #2971 fixed a different assertion,
peak() > 8. They replaced it with a rendezvous barrier. Theactive() == 0assertion was not affected by that change. It became exposed when cache misses grew more frequent. On 2026-10-09, 4479556 addedrelease_unpinned_shared_jsonl_pages, andidle_release_drops_unpinned_prepared_pages_and_keeps_pinned_ones(same module, same suite binary) calls it. That call drops every unpinned page, including this test's pages, which are deliberately left unpinned. So in a full-suite run, a waiting prefetch now often misses the cache and rebuilds.Fix.
start_shared_jsonl_page_prefetch_with_cancellationnow returns each spawned page task'sTaskHandlealongside itsAbortHandle. The production caller (SharedJsonlPathPin::start_prefetches) keeps only the abort handle and drops the task handle. Dropping a task handle detaches the task, which is the same as the oldcx.spawn(..).is_ok(). The test-onlystart_shared_jsonl_page_prefetchreturns the task handles, and the test joins every prefetch before it asserts.Evidence. All runs use
--runs_per_test=50,--run_underataskset -c 0-1wrapper, and--test_arg=<test name>. A temporary test-env switch forced every built page not to fit the cache, which reproduces the full-suite eviction. The switch is not part of this PR.left: 1toleft: 39.registered_persistence_failure_releases_only_after_join_and_writer_fenceRoot cause. The producer had a 250 ms shutdown budget. After the worker joins with the terminal write failed,
stopruns the writer fence. The fence is abegin_write_transactionand rollback that waits for the test's held writer. The test commits that writer only after it observesshutdown_joined(). If the test task ran late, the fence used up the rest of the 250 ms and timed out. Shutdown then returnedobservability_shutdown_deadlineand the producer stayedJOINED, notSETTLED. That produced the gate failureassertion failed: retained.shutdown_settled().Production ordering.
SETTLEDis stored only after the worker joins and the fence completes, or after a terminal write proves the writer settled. A fence that cannot finish leaves the producerJOINED, and the registry entry staysAwaitingWriter. That is the documented retry path. A mutation that storesSETTLEDin place ofJOINED(skipping the fence) fails this test 5 of 5 runs withassertion failed: !retained.shutdown_settled(). So the test still detects the ordering defect its name describes.Fix. The shutdown budget is now 30 s, so the fence ends when the writer is released and not when the budget runs out. The pre-shutdown
sleep(persistence * 6)is removed. It only made sure the blocked event failed early enough for the worker to reply within the 250 ms budget. With the new budget, the event fails withobservability_persistence_deadlinewhether the run loop or the shutdown drain takes it.Evidence. The same flags as above apply. A temporary 400 ms sleep before
blocker.commit()stood in for a starved test task. That sleep is not part of this PR.assertion failed: retained.shutdown_settled().Clippy (
--config=clippy) and rustfmt pass on both touched targets.Fixes #3950