HLE: fail DirectStorage startup when no worker can start #3205
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3207"
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?
Imported from Marvisak/VIctory. Originally posted by yumaste on 2026-11-26T12:46:15Z.
Problem
If every DirectStorage worker thread fails to start, the scheduler is still published. Queue creation then succeeds, but there is no worker to run submitted requests. Reads remain pending and a caller waiting for completion or queue capacity can hang.
Change
Publish the scheduler only after at least one worker starts. If none start, queue creation and staging configuration report
E_OUTOFMEMORY. A partial worker pool still services queues. The process still attempts initialization once. The title stops at startup when staging setup fails, as noted at the call site. It now sees the error there instead of hanging while waiting for I/O.Validation
cargo test --locked -p victory-hle -- --test-threads=1: 153 unit tests and 2 integration tests passed on Windows.cargo clippy --locked -p victory-hle --all-targets --all-features -- -D warningsandcargo xtask policypassed.Coordination claim. Synthetic test data only. AI-assisted (Codex).
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T13:03:35Z.
Independent local verification of head
7088627on Windows 11, Rust 1.100.0/MSVC:cargo test --locked -p victory-hle --lib -- modules::dstorage::tests::a_scheduler_requires_at_least_one_worker --exact— 1 passed, 0 failed.git diff --check origin/main HEAD— clean.Used a worktree-local
CARGO_TARGET_DIR. The scheduler test uses synthetic spawn closures; no D3D12 device or game assets were used. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only).Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-26T13:05:55Z.
Review: COMMENTED
Looks good to me. The doc comment on
scheduler()already promised "Noneif not even one worker could start", and onmainthe code never did that: the scheduler was published beforeSTARTEDran, whatever the spawn count. This makes the code match the comment. I checked it againstmain:create_queuealready mapsNonetoE_OUTOFMEMORY, so with no workers a title now fails at queue creation instead of hanging on its first read.close_lane,queueandsubmitall need a queue that already exists, so they can't hitNonein practice.get_or_init: the workers start while theOnceLockis still initialising. That's safe becausework→executenever callsscheduler(), so no worker can block on the cell it's being started from. Onmainthis was guaranteed by the separateOnce; now it relies on that call graph, so a short comment onstart("workers must not callscheduler()") would keep it from breaking quietly later.Arcinstead of&'static: needed now that the workers start before the scheduler is in the static. The failure path drops it cleanly, and a partial pool keeps its own clones. 👍set_staging_buffer_size: returningE_OUTOFMEMORYthere means Grand Theft Auto VI stops at startup (per the comment above it) instead of hanging later. A clear failure is better here. It might be worth one line in the PR description that this is the visible effect for that title.The test exercises
startwith injected spawns, which covers the decision itself. TheE_OUTOFMEMORYpaths stay untested becausescheduler()is a process-wideOnceLock, which is fair.Imported from Marvisak/VIctory. Originally posted by yumaste on 2026-11-26T13:12:56Z.
Thanks.
09dadafdocuments why workers receive the scheduler directly and must not callscheduler()while theOnceLockis initializing. I also added the startup behavior to the PR description. The synthetic scheduler test still passes.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T22:41:11Z.
NVIDIA full-suite run, to go with the reports above by cloph-dsp, since none of them names a GPU run. Tested exact head
09dadaf(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.a_scheduler_requires_at_least_one_worker.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.