XTaskQueue: terminating a composite queue cancels another queue's pending callback #243

Open
opened 2026-11-24 22:59:33 +00:00 by Bennet0k · 1 comment
Bennet0k commented 2026-11-24 22:59:33 +00:00 (Migrated from github.com)
Contributor

Imported from fxceless/victory-fork. Originally posted by Bennet0k on 2026-11-24T22:59:33Z.


Source

Reproduction. Create a manual base queue and a composite queue using the base ports. Enqueue one immediate callback on each. Terminate the composite queue, then dispatch the base queue. Running the queue logic from 2119b0e returned canceled=true for both callbacks and no work from base dispatch. The base callback should remain queued and run with canceled=false, following the independent queue lifetimes documented by Microsoft.

Proposed fix. Store the submitting queue identity on each pending callback and cancel only callbacks owned by the terminating queue. Retain others in FIFO order and invoke cancellation callbacks outside the port lock. Add a manual-queue regression with the above sequence. #198 covers callbacks that are still delayed. This case uses callbacks already present in the shared port.

Found in an AI-assisted audit of 2119b0e.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6593120219 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/243). Originally posted by [Bennet0k](https://github.com/Bennet0k) on 2026-11-24T22:59:33Z. --- [Source](https://github.com/fxceless/victory-fork/blob/2119b0e44c53aa9648307b0c5c73590290305b1f/crates/victory-hle/src/modules/xasync.rs#L374-L397) **Reproduction.** Create a manual base queue and a composite queue using the base ports. Enqueue one immediate callback on each. Terminate the composite queue, then dispatch the base queue. Running the queue logic from `2119b0e` returned `canceled=true` for both callbacks and no work from base dispatch. The base callback should remain queued and run with `canceled=false`, following the [independent queue lifetimes documented by Microsoft](https://github.com/microsoft/libHttpClient/blob/main/Include/XTaskQueue.h#L1152-L1156). **Proposed fix.** Store the submitting queue identity on each pending callback and cancel only callbacks owned by the terminating queue. Retain others in FIFO order and invoke cancellation callbacks outside the port lock. Add a manual-queue regression with the above sequence. #198 covers callbacks that are still delayed. This case uses callbacks already present in the shared port. Found in an AI-assisted audit of `2119b0e`.
avt0m4t48 commented 2026-11-25 00:10:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-24T23:42:55Z.


Independent public-API tests on exact heads 98e608b8 (#296) and 843eff1b (#324) confirm that both preserve sibling FIFO when terminating a composite queue, including delayed callbacks already on the port. Both checks failed on main 2119b0e.

A separate dispatch-time case persists on all three. While terminate is canceling its work port, the queue is already marked terminated. If a manual reentrant dispatch or the serialized worker dequeues an owned completion in that interval, it passes canceled=false. The sibling's completion correctly gets false. Both invocation paths currently supply a hard-coded flag. Five public API probe outcomes on #296 repeated 25 times in the source-built Linux harness. Fork source · libHttpClient reference

This finding is for callbacks dequeued after termination was marked. A still-sleeping delayed callback is the separate #198 path. Native Windows execution was outside this check.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7147713245 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/issues/243#issuecomment-7147713245). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-24T23:42:55Z. --- Independent public-API tests on exact heads `98e608b8` (#296) and `843eff1b` (#324) confirm that both preserve sibling FIFO when terminating a composite queue, including delayed callbacks already on the port. Both checks failed on main `2119b0e`. A separate dispatch-time case persists on all three. While terminate is canceling its work port, the queue is already marked terminated. If a manual reentrant dispatch or the serialized worker dequeues an owned completion in that interval, it passes `canceled=false`. The sibling's completion correctly gets `false`. Both invocation paths currently supply a hard-coded flag. Five public API probe outcomes on #296 repeated 25 times in the source-built Linux harness. [Fork source](https://github.com/fxceless/victory-fork/blob/98e608b87e0357ddbdecb95a46dd2b7f63d4c2d6/crates/victory-hle/src/modules/xasync.rs#L349-L416) · [libHttpClient reference](https://github.com/microsoft/libHttpClient/blob/d940b02301f2ff1a4b3298766827d7d68f88e1f0/Source/Task/TaskQueue.cpp#L775-L798) This finding is for callbacks dequeued after termination was marked. A still-sleeping delayed callback is the separate #198 path. Native Windows execution was outside this check.
Sign in to join this conversation.
No labels
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.

Reference
fxceless/victory-fork#243
No description provided.