Repository navigation
Tests: alloc_pool checks for STATE held by the caller, not by a parallel test - #3190
tiagonleal wants to merge 2 commits into
Conversation
|
I reproduced one interleaving that explains the remaining With a test-only change to that fixture, I let a competing thread call the actual A test-local completion notification from the fake allocator callback after its final counter update, with a bounded wait before checking the counters, would preserve the exactly-once check while allowing another sweep to own the release. The production ordering deliberately releases outside the lock. This establishes a possible counter failure on the real sweep path; it does not identify the schedule of the earlier stress failures. AI use: OpenAI Codex added the focused interleaving, ran the test and prepared this report. |
|
Tested Independently reran the pinned standalone CPU executable for Both native processes exited 0. Total was 2 passed, 0 failed, 0 ignored, 0 skipped. With another thread holding the lock, Not tested Real allocator state, the allocator test module, runtime callbacks, D3D12, GPU, retail titles, the workspace suite, performance, and flake rate. AI use T3 Code through Codex ( |
07897b1 to
e20411a
Compare
|
@andrewDoing thanks, that is the interleaving. Temporary logging here showed the same thing from the other side: in 40 runs at @JJAutoCompare thanks for the check of the helper. AI use: Claude Code wrote this comment (Claude Fable 5.2); Claude Opus 5.5 ran the loops. |
e20411a to
fb24a2e
Compare
fb24a2e to
2d2dc34
Compare
completion_queries_run_outside_allocator_state and submit_marking_calls_out_unlocked_and_revalidates_the_queue_marker check that a callback runs outside STATE with a single STATE.try_lock(). STATE is process-wide and other alloc_pool tests running in parallel take it for short sections, so that try_lock fails whenever a sibling test holds it at that instant, even though the caller does not (xcl-dev#3180). The checks now retry try_lock for up to 10 s. If the calling thread holds STATE, try_lock keeps returning WouldBlock and the assertion still fails (checked by taking STATE around the Signal call and the in_flight GetCompletedValue call: both tests fail after 10 s). Before: alloc_pool tests with --test-threads=32, 40 runs: 31 failed, these two tests failed 41 times. After: 0 failures of these two.
transferred_owner_is_released_once_outside_state_after_logical_forget asserts (refs, releases) == (0, 1) right after its own sweep. STATE is process-wide, and other alloc_pool tests call forget(), which runs sweep_release_owners() over every retired backing. Under --test-threads=32 one of those sweeps can remove this test's backing first; our sweep then finds nothing and returns while the other thread is still inside the (deliberately slow) fake Release, so the check saw (1, 0). Temporary logging showed the late release came from released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing, submit_marking_calls_out_unlocked_and_revalidates_the_queue_marker and two submit_reservation_* tests, each releasing exactly once. Wait (bounded, 10 s) for the release to land before the unchanged assertions. 40 runs at 32 threads: 1 failure before, 0 after.
2d2dc34 to
353546c
Compare
|
merge-check claim |
|
merge-check |
|
#3183 and #3472 are also part of #3180 but touch other tests (pipeline_library serialisation, fake allocator backings in bind.rs/list_x.rs); no open or merged PR changes these four alloc_pool checks or the late-release wait. The helper only retries Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
Part of #3180. Two
alloc_pooltests failed on CI today on commits that do not touch them:submit_marking_calls_out_unlocked_and_revalidates_the_queue_marker("queue invalidation can run while Signal is outside STATE") andcompletion_queries_run_outside_allocator_state("in-flight polling must not hold STATE").Both check that a callback runs outside
STATEwith a singleSTATE.try_lock().is_ok().STATEis one mutex for the whole process, and the otheralloc_pooltests, which run in parallel, hold it for short stretches. So the singletry_lockfails whenever another test holds the lock at that moment, with nothing wrong in the code under test.A third test in the file,
transferred_owner_is_released_once_outside_state_after_logical_forget, fails under load for a related reason: other tests callforget(), whose sweep runs over every retired backing in the sharedSTATE, so a parallel test can release this test's owner first. The test's own sweep then finds nothing and returns while the other thread is still inside the release, and the check reads(refs, releases) = (1, 0). The owner is still released exactly once; it is not a runtime defect. andrewDoing reproduced this interleaving independently in a comment below.Rebased onto
mainf97120dc.mainadded a test at the place of the helper; both are kept, and the diff is unchanged (+22/-4).What is in it
alloc_pool.rs(test module): a helperstate_not_held_by_caller()retriestry_lockfor up to 10 s, and the four checks use it. Atry_lockfrom the thread that holds the lock never succeeds, so the deadline is reached only when the code really holdsSTATE. Test code only, no assertion removed.transferred_owner_is_released_once_outside_state_after_logical_forgetwaits up to 10 s for the release to arrive before the same assertions as before. +6.Tested
alloc_pooltests run 40 times with--test-threads=32: 31 runs failed, with these two tests panicking 23 and 18 times, at the lines of both CI messages. After: 40 runs, neither test failed.STATEheld around the queueSignaland aroundGetCompletedValuein the code under test (scratch edits, reverted), both fail after 10 s with "queue Signal must run outside STATE" and "in-flight polling must not hold STATE".cargo test -p xcl --lib hle::d3d12x::alloc_pool -- --test-threads=4: 27 passed, 0 failed.cargo test -p xcl --lib alloc_pool -- --test-threads=32, 20 runs on headfb24a2e6: 0 failures.--test-threads=32, each from another test's sweep (released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing,submit_marking_calls_out_unlocked_and_revalidates_the_queue_markertwice,submit_reservation_drop_and_failure_are_fail_closed,submit_reservation_keeps_pre_reset_attribution_across_queues). The test failed in 2 of 40 and 5 of 40 runs in two earlier loops and 1 of 40 in the loop before this commit; 0 of 40 after.mainf97120dc(head353546c6):cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4, one run: 2841 passed, 0 failed, 51 ignored (24SKIPPEDlines: 22no wave64, 2no heap windows; the same 24 in both logs);mainf97120dcon this machine: 2841 passed, 0 failed, 51 ignored.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds in clean trees, one run each,XCL_PREPARE=0, same DXIL cache. No code outside#[cfg(test)]changes; the run is there becausealloc_pool.rsis a runtime file.main(f97120dc):This PR (
353546c6):Not tested
hle::d3d12xtests failed once each when the tests ran with--test-threads=32on an already loaded 16-thread PC; they are listed in CI: tests that fail by timing or shared state keep unrelated PRs red (5 sightings on 28 Nov) #3180 and are not part of this PR.AI use
🤖 Generated with Claude Code