hle/dstorage: fix queue error reset, event handle duplication, close/release races, and pointer validation #81
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!81
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/81/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@certified-retart on GitHub · 2026-11-23 01:52 UTC · original
certified-retart:fix/dstorage-queue-bugs→main· +279 −45 · 1 files · 1 commits · merged 2026-11-23 10:36 UTCSummary
Fixes several queue lifecycle, error-reporting, and pointer-validation bugs in
crates/xcl/src/hle/dstorage.rs:RetrieveErrorRecordnever cleared errors or reseterror_event:ResetEvent(q.error_event)underq.errors.lock()(the same mutex held byQueueInner::failwhen callingSetEvent, avoiding lost notifications).GetErrorEventreturned the internalHANDLEdirectly:error_eventwithDuplicateHandle(..., DUPLICATE_SAME_ACCESS)(matchingfile_get_handle), so the caller can close its returned handle viaCloseHandlewithout invalidating the queue's internal event or causing a double-close inQueueInner::drop.Release()could leak the worker thread andQueueInner:refs.load() == 1pre-check beforefetch_subwith a single atomicfetch_sub(1, Ordering::AcqRel) - 1 == 0check so exactly one thread takesworkerand tears down theArc<QueueInner>↔ worker thread cycle.Close()vs.Enqueue*()/Submit()races and in-flight worker completion:workerthenpending(matchingsubmit()'s lock order) inqueue_closeand checkedclosedunder the respective locks insubmit(),enqueue(), andenqueue_request(), preventing post-close enqueues or worker respawns.closedis set inQueueInner::run(marking remaining submitted statusesE_QUEUE_CLOSED) and waited outside queue locks on aworker_activecondvar inqueue_closeso no worker touches caller buffers afterClose()returns (including for concurrentClose()callers).workerbefore dropping any unsent batch on spawn/send failure so fenceRelease()cannot re-enter while holding the mutex.Entry::Refusedso errors are published in queue order (and skipped if closed before execution).readable()andstatus_vtbl()inqueue_enqueue_status, andreadable()on fence + vtable inqueue_enqueue_signal.Tests
error_record_resets_after_retrieval_and_event_is_duplicatedqueue_release_concurrent_breaks_worker_cyclequeue_validates_status_and_fence_pointers_and_closed_rejects_workcargo test -p xcl --lib hle::dstorage::tests -- --test-threads=2: 8 passed; 0 failed.github-bot referenced this pull request2026-11-26 04:19:41 +00:00
@ivall on GitHub · 2026-11-23 10:36 UTC · original
Merged. Fortnite reads all of its data through DirectStorage – with this it still loads to its splash screen, no DirectStorage errors in the log. Tested on Windows 11 with an RX 9070 (RDNA4):
cargo test --workspacegreen with the retail samples (shader pack, console DLLs, texture archive), lib tests also withXCL_SPLIT_WAVE64=1; Unicorn Overlord, Minecraft and Fortnite run with this round merged. Thanks!