hle(xasync): cancel only owning queue callbacks on XTaskQueueTerminate #296
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by Caasares on 2026-11-24T23:21:15Z.
Fixes #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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.