Tests: recording-memory tests leave no fake allocator backing behind #3472
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3472"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-29T23:15:57Z.
Part of #3180. A recording-memory test leaves a fake allocator backing in
alloc_pool, and a later test on the same worker thread can abort the whole lib test binary.a_recordings_memory_is_held_for_the_pc_allocator_it_is_onresets a list on the fake allocatorother(a Box address + 2), soalloc_poolrecords the list as a user of a backing keyed byother. The test's cleanup removed theLISTSentry but never calledforget_list, soforget(other)found the backing busy and only marked itretire_when_free. After the Box was freed, a later test on the same worker thread whose list reused that stack address went throughon_release, thenforget_list. The backing became free andsweep_release_ownersdroppedID3D12CommandAllocator::from_raw(other)on a fake id. Thewindows-corealignment check on the vtable pointer fails there, and the panic is non-unwinding, so the whole lib test binary aborts (0xc0000409).Seen in CI run 46300047915 on #3190, a PR that only touches
alloc_pooltests: abort inhle::d3d12x::list_x::tests::wait64_flags_do_not_mask_the_recorded_counter, "misaligned pointer dereference: address must be a multiple of 0x8 but is 0x1d1adc819a2". The sighting is listed in #3180.What is in it
list_x.rs: the two reset tests clean up withon_release(key)before forgetting the fake allocators, like their neighbours; the recording-memory test asserts thatalloc_poolkeeps nothing keyed by its fake idsalloc_pool.rs: new#[cfg(test)]helperstracks_for_test(doesSTATEstill key anything by a fake id) anddrop_synthetic_for_test(drop a fake backing and its users' recordings without releasing it)bind.rs: the test that leaves a recording on the fakebusyallocator drops that backing withdrop_synthetic_for_test#[cfg(test)], no runtime behaviour changesTested
cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4on headbe8bce2d: 2841 passed, 0 failed, 51 ignored (24SKIPPEDlines: 22no wave64, 2no heap windows; the same 24 in both logs).mainf97120dcon the same machine: 2841 passed, 0 failed, 51 ignored.7230332c(same diff, before the rebase), with the old cleanup line put back in that one test (LISTS.lock().unwrap().as_mut().unwrap().remove(&key);in place ofon_release(key);),cargo test -p xcl --lib hle::d3d12x::list_x::tests::a_recordings_memory_is_held_for_the_pc_allocator_it_is_on -- --exact --test-threads=1fails on the new assertion withleft: [true, false, false, true]: the list and the fake allocatorotherare still keyed inalloc_pool. With the fix the same command passes.Regression run
scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(a retail title), release builds of both commits,mainf97120dcand this PR's headbe8bce2d, one run each. A second run ofmainafter the PR runs gave 1680 frames.main(f97120dc):This PR (
be8bce2d):Not tested
alloc_pool(device_x,pso_async, the VRAM tests) were not audited.AI use
Imported from ivall/xcl. Originally posted by AAsobu on 2026-11-30T23:05:11Z.
merge-check
base:
86e86fcb33head:
be8bce2d03merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2889 passed, 0 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 no GPU_UPLOAD heaps), the same counts as
mainon this machine; failing: none.review: none. Read the whole diff (+25/-2): everything is in
#[cfg(test)]code (alloc_pool.rstest helpers, one line in abind.rstest, the two reset tests inlist_x.rs), so no runtime path changes.drop_synthetic_for_testremoves the fake backing and its users' recordings without calling a release on the fake id, which is the point.a_recordings_memory_is_held_for_the_pc_allocator_it_is_on(LISTS...remove(&key)in place ofon_release(key)),cargo test -p xcl --lib hle::d3d12x::list_x::tests::a_recordings_memory_is_held_for_the_pc_allocator_it_is_on -- --exact --test-threads=1fails withleft: [true, false, false, true]("the test leaves nothing keyed by its fake ids"), as in the description; with the PR's line it passes.main(ff0c364b) + an unrelated test-only PR, with a second suite running at the same time by mistake, aborted the lib binary inhle::d3d12x::list_x::tests::wait64_flags_do_not_mask_the_recorded_counterwith "misaligned pointer dereference: address must be a multiple of 0x8 but is 0x1b967876262" inwindows-core-0.62.2\src\interface.rs:41, exit 0xc0000409: the same test, message and exit code as the CI sighting in the description.performance: none (test code only). The abort is rare, so repeated runs say little: the lib test binary (
--test-threads=4) ran 5 times each formainand this merge, alternated: no abort in any of the 10, and none in 12 earlier runs ofmain's lib binary here (17 in all); the one abort of this kind I have is the double full-suite run above. One of the 5mainruns had the known flakytitle_texturescascade (12 failures after a poisoned lock, starting witha_placed_texture_gets_the_pages_of_a_level_with_its_texels), which this PR does not touch.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3090 24 GB (driver 621.24, wave32 only), Intel Core i5-10600K, 32 GB, Windows 11 Home build 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5), results checked by me
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:11:55Z.
merge-check
base:
7d86c5d2b7head:
be8bce2d03merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2896 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (alloc_pool.rs
#[cfg(test)]helpers, bind.rs and list_x.rs tests). The leak is real on main:list_x.rs~8132 / ~8172 only remove theLISTSentry, soforgetonly marks the busy fake backingretire_when_free(alloc_pool.rs~1230-1236), and a laterforget_liston a reused address makessweep_release_ownerscallfrom_rawon the fake id (~321), which can abort the test binary. Callingon_release(key)matches the neighbouring tests. Findings (minor): the new "nothing keyed by fake ids" assertion is only ina_recordings_memory_is_held_for_the_pc_allocator_it_is_on(~8166), while the 0x111 / 0x333 reset test (~8117) and the bind test (~7930) get the cleanup without it;tracks_for_testalso looks up allocator ids inof_list, keyed by list (harmless). Fine: everything is inside#[cfg(test)], no assertion is weakened (the bind.rs cleanup runs after the values are captured), and the PR shows its new assertion failing with the old cleanup line. No smoke run here: test-only.performance: no smoke run (the default path doesn't reach this change); not measured. Test-only: no runtime path changes.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:59:05Z.
Triage (#1607) – head
be8bce2#3183 and #3190 are also for #3180 but fix other flaky tests (a serialised pipeline test in
shaders.rs, andalloc_poolchecks thatSTATEis held by the caller). This one fixes the fake allocator backings left behind by thelist_xreset tests and thebind.rsbusy-allocator test. These are separate changes, not duplicates.The changes are test-only (
#[cfg(test)]helpers inalloc_pool.rs,on_release(key)in place of the bareLISTSremoval, like the neighbouring tests do). No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:13:25Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T23:42:34Z.
CI evidence for this fix, from a survey of the 60 most recent failed
Build and test (Windows, no GPU)runs (2026-12-02). Four jobs on branches unrelated tolist_xended withmisaligned pointer dereference: address must be a multiple of 0x8 but is 0x…2(exit 0xc0000409) inside alist_x::tests::wait64_*test:pr/waterfall-1dword)contrib/up-null-vb-ib-view)pr/dxil-helper-outlining)d3d12x/budget-l0-spillover)Each address is a 16-aligned heap address + 2, which is the fake allocator (
Box+2) thata_recordings_memory_is_held_for_the_pc_allocator_it_is_onandreset_commits_state_only_after_native_success_and_always_restores_vtableleave inalloc_pool. On an RTX 5070 Ti, addingalloc_pool::forget_list(key)(what a later test'son_releaseat the same reused stack address does) to the end of the unchanged test reproduces the same abort; withon_release(key)as in this PR, the test passes.Written with Claude Code (Claude Opus 5.5) from the CI logs and that local run.