Repository navigation
XGameRuntime: XTaskQueueIsEmpty counts delayed callbacks not yet due - #1681
Conversation
A delayed callback waits in the timer heap until it is due, and XTaskQueueIsEmpty looked only at the port's items and the callbacks in flight, so the port read as empty meanwhile. libHttpClient's TaskQueuePortImpl::IsEmpty counts its pending list, where delayed entries wait. Look in the timer heap too, taking the locks in the order submit_delayed uses (timer, items, state). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test report for Tested
Does the test notice a broken fix?
Not tested: AMD, retail title, concurrent use. AI use: Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Test report on an NVIDIA card, head Tested
Regression run main: this PR's head: Not tested
AI use: Claude Code (Claude Opus 5.5) built the PR, ran the tests and both smoke runs, read the logs and wrote this report; I checked it before posting. |
XCL PR #1681 compatibility verificationCommit Tested
Of the 18 failures, 13 GPU tests reported Not tested Main-branch baseline, retail-title smoke runs, optional AI use T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against |
…#1681 + xcl-dev#1276) Windows hle/xgameruntime/taskqueue.rs hunks verbatim (cfg(windows)-only, 0 tests run on Linux): xcl-dev#1681 timer-heap leg in XTaskQueueIsEmpty (lock order timer -> items -> state) + test; xcl-dev#1276 inflight reserve under the timer lock + dispatch_due_timed with canceled-execute fallback + test. Fidelity: diff vs pr1681head/pr1276head shows only the other PR's hunks. Linux live twin hle/xtaskqueue_linux.rs gets both semantics (win64 ABI) + 2 Linux-shaped tests. Failing-first shown in an isolated pre-fix worktree (since removed): IsEmpty test FAILED at runtime, due-delayed test failed to compile on missing dispatch_due_timed; both green post. Gates: both cargo checks 0 errors; lib 650/0/1 t=4 (+2); diff --check clean; title fresh-root FAIL set byte-identical pre/post (13: 12 D3D12.X GPU-only + files:delete os-error-2, the latter also failing on pristine HEAD - pre-existing drift, no regress); retail fresh-root SIGSEGV +0x2237320 fault 0x0 exit 139 stubs 20 xgr 3 apis - HOLDS.
, verbatim Windows + Linux twin) Live pr805head=e88ee4d1 still OPEN (merge-base false); Windows hle/xgameruntime/taskqueue.rs hunks hand-applied byte-identical (cherry-pick -n conflicted at the shared test-site tail: steps-49/50 tests moved the append anchor; production + test hunks verified identical to the head by direct diff, only line numbers drift). Fidelity: git diff pr805head shows only steps-49/50 drift (xcl-dev#1276/xcl-dev#1681 timer, xcl-dev#1154 terminate); pool block + mpsc test import + new test byte-identical. Production: fixed clamp(2,8) mpsc pool -> Pool{Mutex<PoolState>,Condvar, base} + MAX_WORKERS=256 + IDLE_EXIT 30s + worker loop + spawn wake-idle-else-grow with rollback + notify on spawn failure. Linux live twin hle/xtaskqueue_linux.rs mirrors the production hunks (ABI-neutral pool; win64 ABI untouched) + 1 Linux-shaped twin test (16 blockers + releaser through wait=true Terminate, extern win64). Failing-first: twin test FAILED pre-fix (7 vs 16, releaser starved on the fixed 8-worker pool), green post-fix. Gates: both cargo checks 0 errors; lib 652/0/1 t=4 (+1); diff --check clean; lock audit clean (named g/ng guards, explicit drop before job). Title fresh-root 12 unique FAILs all D3D12.X GPU-only 0 non-GPU (harness FAILs by design, M2 baseline). Retail fresh-root SIGSEGV game_scarlett_master.exe +0x2237320 fault 0x0 unmapped exit 139 stubs 20 xgr exactly XAsync/XNetworking/XUser unimplemented [] - HOLDS, M1-RE TERMINAL.
|
merge-check claim |
|
merge-check |
|
merge-check |
XTaskQueueIsEmptylooked only at a port's queued items and the callbacks in flight. A callback submitted with a delay (XTaskQueueSubmitDelayedCallback, orXAsyncSchedulewith a delay) waits in the task queue's timer heap until it is due, so while it waited the port read as empty. libHttpClient's task queue, which XTaskQueue is, counts those entries.TaskQueuePortImpl::IsEmptyis(m_queueList->empty()) && (m_pendingList->empty()) && (m_processingCallback == 0), and a delayed entry goes tom_pendingList(TaskQueue.cpp).A title that dispatches until the port is empty before it terminates a queue, or that uses
XTaskQueueIsEmptyto tell whether its timers are done, stopped too early. The delayed callback then ran canceled at termination.XTaskQueueIsEmptynow also looks for the queue's entries on that port in the timer heap. The locks are taken in the ordersubmit_delayedalready uses: the timer heap, then the port's items, then the queue state. No path takes the timer lock while it holds the other two.What is in it
crates/xcl/src/hle/xgameruntime/taskqueue.rs:XTaskQueueIsEmptycounts delayed callbacks not yet due. Testis_empty_counts_delayed_callbacks_not_yet_due: a 60 s delayed callback keeps the work port non-empty and leaves the completion port empty, and termination cancels it.Tested
cargo test --workspace -- --test-threads=4on c53eed3: 859 passed, 0 failed, 42 ignored; SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)XTaskQueueIsEmpty: it fails atassert!(!XTaskQueueIsEmpty(h, PORT_WORK), "a delayed callback not yet due is still queued")Regression run
main:
this PR:
Not tested
XTaskQueueIsEmptywith delayed callbacks pending; the smoke title's run is a regression check only.AI use
🤖 Generated with Claude Code