XAsync: publish the final status before removing a completed call #1205
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1205
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1205"
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?
@Jineggegg on GitHub · 2026-11-28 15:31 UTC · original
Jineggegg:xasync-publish-before-remove→main· +96 −24 · 1 files · 1 commits · merged 2026-11-29 08:16 UTCWhat this changes
An error or zero-size completion removed its call from the registry before provider cleanup ran. A blocking status query arriving during cleanup could miss the call and read
E_PENDINGfrom the block instead of the work's result.donebecomes the published result (Mutex<Option<HRESULT>>), so a waiting query returns the captured result even if the block is reused afterwards.XAsyncGetStatus(wait=true)now waits on the condition variable until that result exists instead of re-reading the block.pending_callreplacesis_current); waiters can still find it.Adapted from Jineggegg/VIctory round 1 item 3 (commit
e071177). One adaptation to currentmain: upstream has noclaimedflag — itscomplete_callguard is thedonelock — so the guard now readsis_some()afterdonebecame anOption, and noclaimedflag is added back. Because cleanup runs without thedonelock, an error/zero-size completion records its result first (that is the guard against a second completion); a successful completion still publishes before recording, as before. The regression test is unchanged in shape: a provider cleanup paused on a barrier, a non-waiting poll that must readE_PENDING, and a waiting query that must returnE_ABORT.Testing
cargo check -p victory-hleis clean.cargo test -p victory-hle --lib xasync: all 15 tests pass, including the newstatus_waits_for_cleanup_to_publish_the_result(run 5 times) and the existing cancellation tests.Notes on nearby open PRs
complete_callto take&Arc<Call>and reworks the wait inXAsyncGetStatus, so whichever lands second needs a rebase in that function.XAsyncCanceland the completion call sites, but not thedoneflag itself.xasync.rschanges are unrelated to this race.@illuminatedfellow on GitHub · 2026-11-28 18:04 UTC · original
Tested on Linux (
xasync.rsbuilt alone with a stub forxgameruntime): all 15 xasync tests pass, andstatus_waits_for_cleanup_to_publish_the_resultfails onmain(E_PENDING instead of E_ABORT) and passes here; 60 runs without a failure.One thing for whichever of this and #898 merges second: they merge without a conflict, but
complete_callhere callscall.provider(OP_CLEANUP, …)directly, while #898 routes cleanup throughCall::cleanup, which waits for aDoWorkorCancelstill running. Merged as they are, #898'scleanup_waits_for_work_under_wayfails every time. Changing that line tocall.cleanup(block)makes all 23 tests of both pass (80 runs, clippy clean).