xtaskqueue: preserve other work on shared ports #403

Closed
github-bot wants to merge 1 commit from gh-pr/403/head into gh-pr/403/base
Owner

@⁠lordon1a on GitHub · 2026-11-24 02:57 UTC · original
fix/xtaskqueue-shared-port-terminate → main · +88 −8 · 1 files · 1 commits · closed without merging

AI-assisted.

Problem

Composite XTaskQueue instances created via XTaskQueueCreateComposite share underlying Port objects, but XTaskQueueTerminate drained all pending tasks from every port on the terminating queue — canceling callbacks queued by other live queues sharing the same port. In addition, a delayed callback already accepted before termination could still be pushed onto a shared port after terminated was set.

Fix

  • Tag queued PendingTask entries with the owning queue's Arc<AtomicBool> cancellation flag.
  • In Port::submit, check owner.load(Ordering::Acquire) under the port lock and immediately run late deliveries as canceled instead of enqueueing them.
  • In XTaskQueueTerminate, retain tasks owned by other queues on shared ports and cancel only tasks belonging to the terminating queue.
  • Add unit test modules::xasync::tests::terminating_one_queue_keeps_other_work_on_the_shared_port.

Verification

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-hle xasync: 6 passed; 0 failed
  • cargo clippy -p victory-hle --all-targets: 0 warnings in xasync.rs
**@⁠lordon1a** on GitHub · 2026-11-24 02:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/403) `fix/xtaskqueue-shared-port-terminate` → `main` · +88 −8 · 1 files · 1 commits · closed without merging AI-assisted. ### Problem Composite `XTaskQueue` instances created via `XTaskQueueCreateComposite` share underlying `Port` objects, but `XTaskQueueTerminate` drained *all* pending tasks from every port on the terminating queue — canceling callbacks queued by other live queues sharing the same port. In addition, a delayed callback already accepted before termination could still be pushed onto a shared port after `terminated` was set. ### Fix - Tag queued `PendingTask` entries with the owning queue's `Arc<AtomicBool>` cancellation flag. - In `Port::submit`, check `owner.load(Ordering::Acquire)` under the port lock and immediately run late deliveries as canceled instead of enqueueing them. - In `XTaskQueueTerminate`, retain tasks owned by other queues on shared ports and cancel only tasks belonging to the terminating queue. - Add unit test `modules::xasync::tests::terminating_one_queue_keeps_other_work_on_the_shared_port`. ### Verification - `cargo xtask policy`: `151 files ok` - `cargo test -p victory-hle xasync`: `6 passed; 0 failed` - `cargo clippy -p victory-hle --all-targets`: 0 warnings in `xasync.rs`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:02:37 +00:00
github-bot closed this pull request 2026-11-26 04:02:37 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:31 UTC · original

Thanks @⁠lordon1a for keeping shared-port work independent across queue termination. I tested head 4ee6efa4a0c686d1def48c4bfebd45caa0aa9d75 with:

cargo test --locked -p victory-hle --lib terminating_one_queue_keeps_other_work_on_the_shared_port -- --test-threads=1

Result: 1 passed, 0 failed (86 filtered out). The test terminates one async queue while another queue has work on the shared port and verifies the other work still completes. This is a synthetic XAsync test, not a title workflow.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/403#issuecomment-7122105307) Thanks @⁠lordon1a for keeping shared-port work independent across queue termination. I tested head `4ee6efa4a0c686d1def48c4bfebd45caa0aa9d75` with: ``` cargo test --locked -p victory-hle --lib terminating_one_queue_keeps_other_work_on_the_shared_port -- --test-threads=1 ``` Result: 1 passed, 0 failed (86 filtered out). The test terminates one async queue while another queue has work on the shared port and verifies the other work still completes. This is a synthetic XAsync test, not a title workflow.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!403
No description provided.