Repository navigation
Conversation
BaggyALPHA
left a comment
There was a problem hiding this comment.
The three new shared-port tests passed independently on Windows. A synthetic reentrant-dispatch test found one remaining cancellation case. Two manual queues share their ports. Queue B has a work callback and a completion callback pending, and queue A has a completion callback pending. While B is terminating, its canceled work callback dispatches the shared completion port through A. B's completion then receives canceled=false, and A's completion correctly receives canceled=false.
The termination flag is already set on B when this happens. Port::take drops the submitting queue identity, and XTaskQueueDispatch always supplies false. The dispatcher needs to read the submitting queue's cancellation state when it invokes the callback, including on the serialized worker path. Microsoft's libHttpClient reference implementation does this in DrainOneItem using the entry's port context. Keeping shared cancellation state with the queued entry would let dispatch distinguish the two callbacks.
AI-assisted (Codex). Tested with synthetic callbacks.
catminou4
left a comment
There was a problem hiding this comment.
Static review only: Windows-only code (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.
XTaskQueueTerminate now cancels only the terminating queue's own tasks on shared ports: submit() takes an owner id + terminated flag, take_owned() collects only that owner's tasks, and two tests cover manual and serialized shared ports (record/hold extern callbacks log cancellation). Previously terminating one queue could cancel another queue's tasks on the same port — a real correctness fix for shared-port titles.
|
I independently tested exact head A follow-up that carries the submitting queue's cancellation state into both dispatch paths passed all 13 isolated Linux tests, including the three API cases, which also passed 25 repeats. The exact PR plus follow-up passed Windows-target checks for AI-assisted using Codex. |
dda166c to
0ef707e
Compare
|
Verified locally: merged
Not tested: the title (this path matters for its shared ports, but I can't run the story load on this machine). AI use: Claude Code (Claude Opus 5.5) ran the checks and wrote this; the results are from the runs described. |
b380544 to
2f7044f
Compare
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into Previous verdict for this head: merge candidate. Generated by Claude Code |
A task already taken from a shared port (the serialized worker, or a dispatcher woken by the queue) ran with `canceled = false` even when its own queue was terminated first: only the queue's id travelled with it. Carry the queue's termination flag in the task and read it when the task runs; `take_owned` matches by that flag's identity. By avt0m4t48 (the follow-up posted on Marvisak#1673), rebased onto this branch with the queue's delayed-callback map kept, and its integration tests included.
|
@avt0m4t48 Thank you — I folded your follow-up in rather than leaving it beside the PR.
Verified here (Windows 10 19045): With that, the serialized-worker control is covered by a test in the PR itself, so the triage's merge-candidate reading now holds for that path too. |
|
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at |
|
Thanks — the same five NVIDIA heap-cap failures as on |
|
I resolved the current On Windows, the integrated tree passed all 155 HLE unit tests and all five integration tests. That includes the three shared-port integration cases for FIFO order, reentrant dispatch cancellation, and the serialized worker. Strict HLE Clippy with all features and targets and the asset policy check passed. The branch fast-forwards from AI-assisted with Codex. |
Fixes #1637.
Ports the verified fix from @AndyLatimer's fork (commit 47e61a2 by Manuel Pérez), applied unchanged onto
ffe310e; the commit keeps its original author.Summary
XTaskQueueTerminatedrained every port unconditionally, so terminating one queue cancelled the queued callbacks and pendingXAsyncwork of every other queue sharing that port (manual, serialized, or composite queues mapping both ports to one shared port).Queuegets a monotonic id, shared acrossXTaskQueueDuplicateHandleand distinct for composite queues.Port::take_ownedremoves only the terminating queue's tasks, keeping other queues' order.Port::submitre-checksqueue.terminatedunder the port lock, so a task racing with termination is cancelled instead of enqueued after the drain.Tests
Three new synthetic tests (also in the commit): shared manual port with duplicate handles and a composite queue on one port, shared serialized port, and pending
XAsyncRuncalls across composite queues. All pass with the fix and fail before it.Validation
cargo test -p victory-hle --locked -- --test-threads=1— passed (97 unit tests and 1 integration test).cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings— passed.cargo xtask policy— passed (154 files).rustfmt --edition 2024 --checkon the file reports only pre-existing hunks in untouched code.