XAsync: a wait on a failed call during its cleanup waits for the status #374
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!374
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-374"
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?
@marquezinii on GitHub · 2026-11-24 02:43 UTC · original
marquezinii:fix/xasync-wait-for-failed-call→main· +59 −3 · 1 files · 1 commits · openA failed (or zero-size) call is removed from
CALLSand has its provider's cleanup run inXAsyncCompletebefore its status is stored. A thread callingXAsyncGetStatus(block, true)in that window finds no call, so it does not wait, and reads the status that is stillE_PENDING. The docs say a wait returns only once the call "either completes or is canceled".This keeps the order (cleanup, then the status), which #114 also relies on, and fixes the waiter instead: when there is no call for the block and its status is still pending, it waits on a condition variable that
XAsyncCompletenotifies after it publishes a status. The check and the wait are done under the same lock the notifier takes after the store, so a wakeup cannot be lost.Tested with a new test: a provider whose cleanup starts a thread that waits on the block, then gives it 100 ms to find the call gone. Before the change that thread gets
E_PENDING(3 of 3 runs); now it getsE_ABORT(5 of 5 runs).cargo test -p victory-hlepasses and clippy reports nothing new. Not tried in a title run.The change sits next to the lines #114 edits in
XAsyncComplete, so whichever lands second may need a trivial rebase.https://learn.microsoft.com/gaming/gdk/docs/reference/system/xasync/functions/xasyncgetstatus
@jeremygold02 on GitHub · 2026-11-24 04:09 UTC · original
Thanks @marquezinii for this waiter-race fix. I tested head
9d6bc0c7c6811c012f39501aa297ddd261d3870fwith:Result: 1 passed, 0 failed (86 filtered out). The regression test starts a waiter during failed-call cleanup and verifies
XAsyncGetStatusobserves the publishedE_ABORTinstead of returning while the status is still pending. This is a synthetic concurrency test; I did not run a title.@Makto94 on GitHub · 2026-11-24 19:32 UTC · original
CI evidence that this flake turns unrelated PRs red:
shader/per-lane-phi, PR #566, a shader-only change, commite09dbb6) failed onmodules::xasync::tests::run_returns_the_work_result:The status is read while the call is still pending. #566 does not touch
victory-hle. This PR makes the wait wait for the status, which is the race shown here.@Marvisak on GitHub · 2026-11-25 00:15 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-hle/src/modules/xasync.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.