Tests: tell a leaked XApu buffer from another allocation at its address #2700
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2700
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2700"
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?
@sage-sage on GitHub · 2026-11-26 07:12 UTC · original
sage-sage:tests/xapu-connect-release-check→main· +28 −6 · 1 files · 1 commits · openhle::acphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failureis flaky in parallel runs: it checks that the data buffer was released by askingVirtualQuerywhether its address is free, and another test's thread can get an allocation at that address between the release and the check (left: 4096, right: 65536, a 4 KiB committed region where the 64 KiB buffer was). Test-only change.What is in it
crates/xcl/src/hle/acphal.rs: the test's allocator reserves 0x53000 bytes (a size nothing else in the process allocates) and commits the buffer at its start (a failed commit releases the reservation); the check fails only if an allocation of exactly that size still starts at the buffer's address. Another allocation there, or none, passes.Tested
b49be18, headc8a7d45cargo test --workspace -- --test-threads=4: 1435 passed, 0 failed, 47 ignoredhle::lib tests at--test-threads=12: before this change (mainplus an unrelatedd3d12xfix), about 200 runs: this test failed 7 times; with it (b4ea470, the previous head;c8a7d45only adds the failed-commit cleanup below), 300 runs: 0 times (the other failures in those runs were the knowna_dispatch_with_a_pipeline_still_building_waits_at_the_submitandplaced_title_textures_share_vram_and_preserve_pixelsflakes, which #2691 / #1453 and #2591 fix, and one device removal)VirtualFreeinxapu_connect_withtaken out (local only), the test fails (data buffer must be released); with another allocation made at the freed address just before the check (local probe), it passesRegression run
#[cfg(test)]test inacphal.rschanges).Not tested
AI use
🤖 Generated with Claude Code
@luckyteagirl on GitHub · 2026-11-26 08:23 UTC · original · reviewed
At head
b4ea470062ddef4c949c044524b68b556eca3750, the new test allocator reservesRESERVEDbytes and then commitssz(acphal.rs:1299-1303). If the reserve succeeds but the commit returns null,then_some(p)discards the only base pointer and returnsNone; the 0x53000-byte reservation remains until the test process exits. This is particularly possible under the commit pressure where this OOM fixture runs. Could the failed-commit branch callVirtualFree(p, 0, MEM_RELEASE)before returningNone? Microsoft's VirtualFree contract specifies the reserved base and zero size forMEM_RELEASE.This is a source-derived test-only review of the exact head; I did not inject a commit failure. AI use: OpenAI Codex (GPT-6.2 Sol) identified the partial-allocation path, and I checked the diff and Win32 contract before posting.
b4ea470062toc8a7d45578@sage-sage on GitHub · 2026-11-26 08:55 UTC · original
@luckyteagirl thank you, fixed in
c8a7d45(squashed): when the commit fails, the test allocator now releases the reservation (VirtualFree(p, 0, MEM_RELEASE)) before returningNone.cargo test --workspace -- --test-threads=4onc8a7d45: 1435 passed, 0 failed, 47 ignored (RTX 4080 SUPER, debug); I did not inject a commit failure either.Claude Code (Claude Opus 5.5) made the change, ran the tests and wrote this reply.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.