Repository navigation
DirectStorage: Close completes what was submitted - #430
marquezinii wants to merge 1 commit into
Conversation
IDStorageQueueX::Close blocks until all enqueued requests complete or fail. close_lane dropped submitted reads that had not started and every pending status entry, and waited only for the reads already running, so a title polling a status entry after Close waited forever. Requests enqueued but never submitted are still dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified
Not covered: a real title queue at close, and throughput/latency effects (no game data here). |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 129d289 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed). I ran the new closing_a_queue_completes_what_was_submitted 8 more times on its own and it passed each time (about 0.1 s each), with no hang.
I traced the new wait to check that it always ends:
Lanes::starttakes reads from any lane with reads, closed or not, so submitted reads still run afterClose.finishremoves the job fromrunningand callsflush, which writes every status entry with no earlier read outstanding. Oncereadsandrunningare empty,statusesempties too, and each worker'sfinished.notify_all()wakes the waiter.- Statuses with no reads ahead of them are flushed in
submit, so they cannot be left in a lane that has nothing running. unsubmitted.clear()keepsa_closed_queue_completes_nothingvalid.
One edge case, not blocking: scheduler() returns Some even when no worker thread started. Before this change Close returned at once in that case. Now it waits forever if reads were submitted. Every read on such a lane already stalls forever, so this only moves where the hang shows up, but a workers == 0 guard in close_lane (or scheduler() returning None, as its doc says) would rule it out.
AI-assisted (Claude Code).
…as submitted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Automated triage for the maintainers. Merge candidate. CI: no check runs on the head commit. Generated by Claude Code |
IDStorageQueueX::Close"blocks until all enqueued requests either complete or fail. After the method returns, the queue will no longer complete any more requests, even if some are submitted."close_laneinstead cleared the lane's submitted reads that had not started and all of its pending status entries, then waited only for the reads already running. A status entry behind a dropped read stayedE_PENDINGfor good, so a title pollingIsCompleteafterClosewould spin forever. Grand Theft Auto VI callsCloseon its queues (the comment onclosesays so).close_lanenow drops only what was enqueued but never submitted (soa_closed_queue_completes_nothingstill holds) and waits until the lane has no reads left, none running and no status entry unwritten. The workers already take reads from a closed lane andfinishflushes its statuses, so nothing else changes.Tested with a new test that submits 32 reads of 256 KiB and a status entry, then closes the queue at once: before the change the status was still
E_PENDINGafterClose(3 of 3 runs); now it isS_OKand the destination holds the whole file (3 of 3).cargo test -p victory-hlepasses and clippy reports nothing new.#234 also touches
close_lane(its counters), so one of the two may need a small rebase.https://learn.microsoft.com/gaming/gdk/docs/reference/system/dstorage/interfaces/idstoragequeuex/methods/idstoragequeuex_close