hle(xasync): cancel only owning queue callbacks on XTaskQueueTerminate #296
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!296
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-296"
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?
@Caasares on GitHub · 2026-11-24 23:21 UTC · original
Caasares:fix/xtaskqueue-composite-terminate→main· +264 −3 · 1 files · 1 commits · openFixes #243
Root Cause
XTaskQueueTerminatepreviously drained every pendingTaskfrom eachPortreferenced by the terminatingQueue(lock(&port.tasks).drain(..)). Because composite queues (XTaskQueueCreateComposite) shareArc<Port>instances with their underlying queues (such as a manual base queue), terminating a composite queue canceled pending callbacks submitted through other queues sharing those ports.Fix
Queuea monotonicu64identifier (NEXT_QUEUE_ID) and stored the submittingqueue_idon eachTaskinQueue::submit(crates/victory-hle/src/modules/xasync.rs).XTaskQueueTerminateto retain callbacks belonging to other queues in FIFO order (tasks.retain(...)), draining only tasks wheretask.queue_id == queue.idacross bothWORKandCOMPLETIONports.port.tasksmutex guard before callingport.ready.notify_all()and invoking canceled callbacks (canceled = true), preventing deadlocks if a cancellation callback re-enters queue APIs.crates/victory-hle/src/modules/xasync.rs:terminating_composite_queue_preserves_base_queue_callbacks: reproduces #243 acrossWORKandCOMPLETIONports with a manual base queue and a composite queue.terminating_composite_queue_preserves_fifo_and_unlocks_before_canceling: verifies FIFO preservation across interleaved submissions and re-entrantXTaskQueueSubmitDelayedCallbackcalls from inside a cancellation callback.Verification
All commands run inside
wt-vf-243:cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)cargo test --workspace --locked: passed (498 passed; 0 failed; 7 ignoredacross workspace;victory-hleunit tests97 passed; 0 failed,xtaskasset-policy4 passed; 0 failed)cargo fmt --all -- --check: failed only on pre-existing formatting differences in untouched files across the repository; newly added code incrates/victory-hle/src/modules/xasync.rswas checked withrustfmt --edition 2024 --check.Note: AI-assisted fix; contains no game files, code, or assets.
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.