dstorage: retry raw file read on ERROR_INVALID_USER_BUFFER #50

Open
github-bot wants to merge 1 commit from github-bot/gh-50 into main AGit
Owner

@⁠jmal423 on GitHub · 2026-11-25 13:01 UTC · original
jmal423:pr/dstorage-raw-read-retry → main · +12 −0 · 1 files · 1 commits · open

Fixes intermittent ERROR_INVALID_USER_BUFFER (Win32 error 1784) during DirectStorage raw file reads (request.options == 0) on Windows when reading directly into guest/pinned memory buffers.

  • Retries read_into via a temporary heap buffer on ERROR_INVALID_USER_BUFFER and copies the result into the destination slice.

Tested on Windows 11 / AMD Radeon RX 9070 XT:

  • cargo test -p victory-hle: 103 passed, 0 failed, 1 ignored
  • Live GTA 6 Series X session (24m35s up to the heist): 0 dstorage 1784 failures, 0 crashes.
**@⁠jmal423** on GitHub · 2026-11-25 13:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/50) `jmal423:pr/dstorage-raw-read-retry` → `main` · +12 −0 · 1 files · 1 commits · open Fixes intermittent `ERROR_INVALID_USER_BUFFER` (Win32 error 1784) during DirectStorage raw file reads (`request.options == 0`) on Windows when reading directly into guest/pinned memory buffers. - Retries `read_into` via a temporary heap buffer on `ERROR_INVALID_USER_BUFFER` and copies the result into the destination slice. Tested on Windows 11 / AMD Radeon RX 9070 XT: - `cargo test -p victory-hle`: 103 passed, 0 failed, 1 ignored - Live GTA 6 Series X session (24m35s up to the heist): 0 `dstorage` 1784 failures, 0 crashes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:34:32 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 13:01 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-25 13:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/50#pullrequestreview-6058087389) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 15:35 UTC · original · reviewed

AI-assisted review; I inspected the retry path and the PR test changes. I did not run the tests or game.

**@⁠gut0to** on GitHub · 2026-11-26 15:35 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/50#pullrequestreview-6076860716) · **reviewed** AI-assisted review; I inspected the retry path and the PR test changes. I did not run the tests or game.
@ -943,1 +947,4 @@
Ok(n) => done += n,
// Retry only the raw file-to-title path on ERROR_INVALID_USER_BUFFER.
// Keep any bytes already read and report the original error on exhaustion.
Err(error) if request.options == 0 && error.raw_os_error() == Some(1784) && retries < 3 => {
Author
Owner

@⁠gut0to on GitHub · 2026-11-26 15:35 UTC · original

Could a deterministic regression exercise a partial seek_read, then Win32 1784, then a successful retry? It would protect the key invariant here: the retry starts at request.offset + done, preserves the bytes already read, and only retries the remaining slice. A retry-exhaustion case would also pin down the final error behavior.

**@⁠gut0to** on GitHub · 2026-11-26 15:35 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/50#discussion_r4710529112) Could a deterministic regression exercise a partial `seek_read`, then Win32 1784, then a successful retry? It would protect the key invariant here: the retry starts at `request.offset + done`, preserves the bytes already read, and only retries the remaining slice. A retry-exhaustion case would also pin down the final error behavior.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/50/head:github-bot/gh-50'
git switch 'github-bot/gh-50'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-50'
git switch 'github-bot/gh-50'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-50'
git switch 'github-bot/gh-50'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-50'
git switch 'main'
git merge --squash 'github-bot/gh-50'
git switch 'main'
git merge --ff-only 'github-bot/gh-50'
git switch 'main'
git merge 'github-bot/gh-50'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.