runtime: fail a DirectStorage request on allocation failure #1403

Merged
tedin7 merged 15 commits from upstream-pr/1410 into main 2026-11-24 15:17:36 +00:00
tedin7 commented 2026-11-24 10:54:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:54:27Z.


What

The DirectStorage stand-in's queue worker (src/startup_stubs/xcrdapi.cpp):

  • The handler around each entry now only records a short reason in a fixed 96-byte buffer. The failure accounting and log line run after the handler has left, when the request's buffers are already freed.
  • catch (...) also fails the request, so a non-standard exception no longer reaches std::terminate.
  • The worker is a CreateThread thread with a stack committed at creation (1 MiB, worker_stack_commit) instead of a std::thread whose stack grows on demand.
  • New check startup_storage_alloc_failure (tests/startup_storage_alloc_failure.cpp), registered next to startup_storage_file_range.
  • A paragraph in docs/startup-runtime.md.

When no allocation fails the success path is unchanged: same run_entry call, same bookkeeping.

Why

Addresses #1199 (item 3 only)

Done-when for this item: an allocation failure in the worker fails the request instead of ending the process. 5e775dda already catches std::exception on the worker, but that was never tested, and the issue reports a stack overflow (0xc00000fd) while the exception was handled. The handler formatted and logged inside the catch, on a stack that is committed page by page. When the system is out of commit, an untouched stack page cannot be committed either, so more stack use at that point can end in a stack overflow even though the stack is shallow. That is the justified defence here. It is a reading of the code, not a measurement.

Items 1 (#1270) and 2 (SEC_RESERVE, src/xmem_mapped_pages.cpp) are not touched. The BCPack decoder is not touched. #1390 also edits xcrdapi.cpp, but one line in execute_request; this change is in the worker functions, so the hunks do not overlap.

Tested

Windows (not run locally):

cmake --preset dev
cmake --build --preset dev --target startup_storage_alloc_failure
ctest --preset dev --no-tests=error -R '^startup_storage_alloc_failure$' -V
cmake --preset release
cmake --build --preset release --target startup_storage_alloc_failure
ctest --preset release --no-tests=error -R '^startup_storage_alloc_failure$' -V

The check puts its own process under a job commit limit (256 MiB above its commit), then on one queue: a normal request succeeds; a request that declares a 1.5 GiB inflated size fails within 15 s with a failure status and an unchanged destination; a normal request after it returns correct data. It returns 77 where the limit is not enforced or cannot be applied.

Linux, with x86_64-w64-mingw32-g++ 14 and Wine:

  • The new test source and a mingw build of xcrdapi.cpp (with a local shim for __try/__except, since mingw lacks them) build. The committed test returns 77 under Wine: Wine does not enforce the job commit limit.
  • Fault injection used only for this local run, not committed: the DLL was linked with an extra operator new that throws std::bad_alloc for allocations of 1 GiB or more, and the test's limit steps were bypassed. With this change: exit 0, the log shows entry type 0 failed: out of memory, then the next request is served.
  • Same injection on origin/main: exit 0 (the existing catch already handles it, as the log shows std::bad_alloc).
  • Same injection on origin/main with the try/catch removed (the state before 5e775dda): terminate called after throwing an instance of 'std::bad_alloc', exit 3.
  • python3 -B tests/docs_links_check.py, python3 -B tests/bidi_controls_check.py, git diff --check: pass.
  • x2w_pipe.py preflight: WARN (file overlap with open PRs only).

MSVC and WARP were not run locally.

Unverified

  • That the original 0xc00000fd comes from a stack page that could not be committed; it was not reproduced.
  • Whether the Windows job commit limit makes the 1.5 GiB buffer fail as intended on the Windows runner; Wine could not show it.
  • That this change alone changes the outcome of a real run at the commit limit. The test proves the failure path and survival; it does not fail on origin/main, because the catch already existed.
  • Whether 1 MiB of committed stack per queue is enough or too much.
  • MSVC build of the new code (CreateThread with the static runtime, as the heartbeat thread already does).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6580181883 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T10:54:27Z. --- ## What The DirectStorage stand-in's queue worker (`src/startup_stubs/xcrdapi.cpp`): - The handler around each entry now only records a short reason in a fixed 96-byte buffer. The failure accounting and log line run after the handler has left, when the request's buffers are already freed. - `catch (...)` also fails the request, so a non-standard exception no longer reaches `std::terminate`. - The worker is a `CreateThread` thread with a stack committed at creation (1 MiB, `worker_stack_commit`) instead of a `std::thread` whose stack grows on demand. - New check `startup_storage_alloc_failure` (`tests/startup_storage_alloc_failure.cpp`), registered next to `startup_storage_file_range`. - A paragraph in `docs/startup-runtime.md`. When no allocation fails the success path is unchanged: same `run_entry` call, same bookkeeping. ## Why Addresses #1199 (item 3 only) Done-when for this item: an allocation failure in the worker fails the request instead of ending the process. `5e775dda` already catches `std::exception` on the worker, but that was never tested, and the issue reports a stack overflow (0xc00000fd) while the exception was handled. The handler formatted and logged inside the catch, on a stack that is committed page by page. When the system is out of commit, an untouched stack page cannot be committed either, so more stack use at that point can end in a stack overflow even though the stack is shallow. That is the justified defence here. It is a reading of the code, not a measurement. Items 1 (#1270) and 2 (`SEC_RESERVE`, `src/xmem_mapped_pages.cpp`) are not touched. The BCPack decoder is not touched. #1390 also edits `xcrdapi.cpp`, but one line in `execute_request`; this change is in the worker functions, so the hunks do not overlap. ## Tested Windows (not run locally): ``` cmake --preset dev cmake --build --preset dev --target startup_storage_alloc_failure ctest --preset dev --no-tests=error -R '^startup_storage_alloc_failure$' -V cmake --preset release cmake --build --preset release --target startup_storage_alloc_failure ctest --preset release --no-tests=error -R '^startup_storage_alloc_failure$' -V ``` The check puts its own process under a job commit limit (256 MiB above its commit), then on one queue: a normal request succeeds; a request that declares a 1.5 GiB inflated size fails within 15 s with a failure status and an unchanged destination; a normal request after it returns correct data. It returns 77 where the limit is not enforced or cannot be applied. Linux, with x86_64-w64-mingw32-g++ 14 and Wine: - The new test source and a mingw build of `xcrdapi.cpp` (with a local shim for `__try`/`__except`, since mingw lacks them) build. The committed test returns 77 under Wine: Wine does not enforce the job commit limit. - Fault injection used only for this local run, not committed: the DLL was linked with an extra `operator new` that throws `std::bad_alloc` for allocations of 1 GiB or more, and the test's limit steps were bypassed. With this change: exit 0, the log shows `entry type 0 failed: out of memory`, then the next request is served. - Same injection on `origin/main`: exit 0 (the existing catch already handles it, as the log shows `std::bad_alloc`). - Same injection on `origin/main` with the `try`/`catch` removed (the state before `5e775dda`): `terminate called after throwing an instance of 'std::bad_alloc'`, exit 3. - `python3 -B tests/docs_links_check.py`, `python3 -B tests/bidi_controls_check.py`, `git diff --check`: pass. - `x2w_pipe.py preflight`: WARN (file overlap with open PRs only). MSVC and WARP were not run locally. ## Unverified - That the original 0xc00000fd comes from a stack page that could not be committed; it was not reproduced. - Whether the Windows job commit limit makes the 1.5 GiB buffer fail as intended on the Windows runner; Wine could not show it. - That this change alone changes the outcome of a real run at the commit limit. The test proves the failure path and survival; it does not fail on `origin/main`, because the catch already existed. - Whether 1 MiB of committed stack per queue is enough or too much. - MSVC build of the new code (`CreateThread` with the static runtime, as the heartbeat thread already does). AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 11:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:57:08Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit 6127f0c9 (real job-commit-limit enforcement, NOT skipped):

  • Debug (--preset dev): ctest --preset dev -R '^startup_storage_alloc_failure$' --no-tests=error --output-on-failure — 1/1 passed (0.05s)
  • Release /O2 (--preset release): ctest --preset release -R '^startup_storage_alloc_failure$' --no-tests=error --output-on-failure — 1/1 passed (0.05s)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129459026 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7129459026). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T10:57:08Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit `6127f0c9` (real job-commit-limit enforcement, NOT skipped): - **Debug (`--preset dev`)**: `ctest --preset dev -R '^startup_storage_alloc_failure$' --no-tests=error --output-on-failure` — **1/1 passed** (0.05s) - **Release `/O2` (`--preset release`)**: `ctest --preset release -R '^startup_storage_alloc_failure$' --no-tests=error --output-on-failure` — **1/1 passed** (0.05s)
chatgpt-codex-connector[bot commented 2026-11-24 11:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T10:57:19Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T11:04:00.268102Z 6127f0c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129462761 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7129462761). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T10:57:19Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"6127f0c971a18aefac6d8ff1961ae91feadf1b69","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T11:04:00.268102Z">2026-11-24T11:04:00.268102Z</relative-time> | `6127f0c` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
chatgpt-codex-connector[bot commented 2026-11-24 12:02:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:03:58Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6127f0c971

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038044394 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6038044394). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T11:03:58Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `6127f0c971` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
tedin7 commented 2026-11-24 12:02:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:10:20Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038136208 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6038136208). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:10:20Z. **Review:** COMMENTED --- _No description provided._
R0Y00 commented 2026-11-24 12:02:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T11:15:30Z.

Review: CHANGES_REQUESTED


Windows Release passed startup_storage_file_range and startup_storage_alloc_failure on 6bdd33c. That covers a worker servicing the next request after an allocation failure. Two points remain in the new worker-start path:

  • QueueWork constructs three std::deques. A constructor allocation can throw std::bad_alloc even with new (std::nothrow). Catch construction failure at the queue boundary so the out-of-memory path returns the intended status.
  • If both CreateThread attempts fail, push completes a status entry or signals a fence immediately. Those effects can happen inside Enqueue, before the caller calls Submit. Please keep the existing deferred-completion contract and add a deterministic, source-built worker-start failure control that checks pending status and an unchanged fence before Submit, then failure status and fence completion afterwards.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038219950 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6038219950). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T11:15:30Z. **Review:** CHANGES_REQUESTED --- Windows Release passed startup_storage_file_range and startup_storage_alloc_failure on 6bdd33c. That covers a worker servicing the next request after an allocation failure. Two points remain in the new worker-start path: - QueueWork constructs three std::deques. A constructor allocation can throw std::bad_alloc even with new (std::nothrow). Catch construction failure at the queue boundary so the out-of-memory path returns the intended status. - If both CreateThread attempts fail, push completes a status entry or signals a fence immediately. Those effects can happen inside Enqueue, before the caller calls Submit. Please keep the existing deferred-completion contract and add a deterministic, source-built worker-start failure control that checks pending status and an unchanged fence before Submit, then failure status and fence completion afterwards.
R0Y00 commented 2026-11-24 12:02:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T11:40:48Z.

Review: CHANGES_REQUESTED


The constructor catch and worker-start control address part of the previous review. 8e8e372 still changes completion ordering. Submit calls fail_unrecorded before queueing earlier recorded entries, so a fence can signal before their writes run, and a failure can reach the wrong status entry. The last-resort allocation failure can still complete from Enqueue. Preserve FIFO across recorded and failed entries, or keep this PR focused on worker-start/worker-body failure and handle enqueue-allocation recovery separately with a mixed-order fixture.

Independent Windows Release at this head: startup_storage_file_range and startup_storage_alloc_failure passed, while startup_storage_worker_start failed. The fixture reported that the request after the failure returned wrong data with Enqueue allocation 9 and Submit allocation 1 selected.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6038541281 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6038541281). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T11:40:48Z. **Review:** CHANGES_REQUESTED --- The constructor catch and worker-start control address part of the previous review. 8e8e372 still changes completion ordering. Submit calls fail_unrecorded before queueing earlier recorded entries, so a fence can signal before their writes run, and a failure can reach the wrong status entry. The last-resort allocation failure can still complete from Enqueue. Preserve FIFO across recorded and failed entries, or keep this PR focused on worker-start/worker-body failure and handle enqueue-allocation recovery separately with a mixed-order fixture. Independent Windows Release at this head: startup_storage_file_range and startup_storage_alloc_failure passed, while startup_storage_worker_start failed. The fixture reported that the request after the failure returned wrong data with Enqueue allocation 9 and Submit allocation 1 selected.
SimSalabimse commented 2026-11-24 12:03:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T11:19:14Z.


Tested on Windows 11 26200, MSVC 19.42, RTX 4070 Ti (driver 621.35) at c15ff1a: startup_storage_alloc_failure failed. Worker startup returned error 1455, and the queue did not recover (hr 0x8007000e).

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129944569 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7129944569). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T11:19:14Z. --- Tested on Windows 11 26200, MSVC 19.42, RTX 4070 Ti (driver 621.35) at c15ff1a: `startup_storage_alloc_failure` **failed**. Worker startup returned error 1455, and the queue did not recover (hr 0x8007000e). AI-Assisted
tedin7 commented 2026-11-24 12:03:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:59:31Z.


Both points are addressed in 3b45fdf9 (on top of 910d428f), together with two escapes the new checks found on the way.

Your two points

  • QueueWork construction: ensure_work() now builds the work inside a try/catch (const std::bad_alloc&) at the queue boundary and treats a throwing constructor like a null result. The push_back calls that can throw the same way in push() and submit() are guarded too, and nothing leaves Enqueue or Submit.
  • Deferred completion: when no worker can be started, Enqueue only records the entry. The status entry stays E_PENDING and the fence is untouched until Submit. Submit retries the start once; if it still cannot run, the recorded entries complete with E_OUTOFMEMORY and the fences are signaled there, not earlier.

What the Windows runs found while testing this

  • Entry::tokens was a std::vector: in MSVC Debug its implicitly noexcept constructors and moves allocate a container proxy, so a failed allocation there ended in std::terminate. It is now a unique_ptr<ULONG_PTR[]> plus a count.
  • Entries that could not be stored went to a separate list and lost their order against stored ones, so a deferred status entry could consume pending before the waiting requests were failed, and the next status entry inherited that failure. Once one entry is deferred, later entries now follow it until the next Submit, and Submit handles the stored prefix before the deferred suffix.

Checks

  • startup_storage_worker_start: deterministic start-failure control (pending status and unchanged fence before Submit, failure status and signaled fence after), a retry that starts the worker at Submit, a sweep that fails the N-th allocation at Enqueue and at Submit on the calling thread and on every thread, a page-token path sweep, and 1008 order cases (status first or last, 1 to 9 requests). Against the earlier sources the new controls fail for the expected reasons (std::terminate at the sweep; the leak at 5 requests, Enqueue allocation 8, Submit allocation 1).
  • Windows Server 2025 (Build 26100, MSVC 14.44) at 3b45fdf9: startup_storage_file_range, startup_storage_alloc_failure and startup_storage_worker_start pass 3/3 in Debug (--preset dev, 36.14 s total) and in Release /O2 (--preset release, 35.54 s total).
  • Linux/Wine (MinGW, libstdc++): the same controls pass; the job-commit-limit check skips there as before.

Known limits (also in docs/startup-runtime.md)

  • After the first allocation failure, later entries until the next Submit fail with E_OUTOFMEMORY even if memory recovered.
  • When the stored prefix runs on the worker, a deferred status entry fails inside Submit and cannot see failures the worker finds later in the prefix; the next status entry will.
  • If the small deferral record itself cannot be allocated, that entry fails immediately and can be out of order.

startup_storage_worker_start takes about 35 s on Windows against its 60 s timeout (the sweeps dominate). I can trim the sweep bounds if you prefer more headroom on slower runners.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130813968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7130813968). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:59:31Z. --- Both points are addressed in 3b45fdf9 (on top of 910d428f), together with two escapes the new checks found on the way. **Your two points** - `QueueWork` construction: `ensure_work()` now builds the work inside a `try/catch (const std::bad_alloc&)` at the queue boundary and treats a throwing constructor like a null result. The `push_back` calls that can throw the same way in `push()` and `submit()` are guarded too, and nothing leaves Enqueue or Submit. - Deferred completion: when no worker can be started, Enqueue only records the entry. The status entry stays `E_PENDING` and the fence is untouched until Submit. Submit retries the start once; if it still cannot run, the recorded entries complete with `E_OUTOFMEMORY` and the fences are signaled there, not earlier. **What the Windows runs found while testing this** - `Entry::tokens` was a `std::vector`: in MSVC Debug its implicitly noexcept constructors and moves allocate a container proxy, so a failed allocation there ended in `std::terminate`. It is now a `unique_ptr<ULONG_PTR[]>` plus a count. - Entries that could not be stored went to a separate list and lost their order against stored ones, so a deferred status entry could consume `pending` before the waiting requests were failed, and the next status entry inherited that failure. Once one entry is deferred, later entries now follow it until the next Submit, and Submit handles the stored prefix before the deferred suffix. **Checks** - `startup_storage_worker_start`: deterministic start-failure control (pending status and unchanged fence before Submit, failure status and signaled fence after), a retry that starts the worker at Submit, a sweep that fails the N-th allocation at Enqueue and at Submit on the calling thread and on every thread, a page-token path sweep, and 1008 order cases (status first or last, 1 to 9 requests). Against the earlier sources the new controls fail for the expected reasons (`std::terminate` at the sweep; the leak at 5 requests, Enqueue allocation 8, Submit allocation 1). - Windows Server 2025 (Build 26100, MSVC 14.44) at 3b45fdf9: `startup_storage_file_range`, `startup_storage_alloc_failure` and `startup_storage_worker_start` pass 3/3 in Debug (`--preset dev`, 36.14 s total) and in Release /O2 (`--preset release`, 35.54 s total). - Linux/Wine (MinGW, libstdc++): the same controls pass; the job-commit-limit check skips there as before. **Known limits** (also in `docs/startup-runtime.md`) - After the first allocation failure, later entries until the next Submit fail with `E_OUTOFMEMORY` even if memory recovered. - When the stored prefix runs on the worker, a deferred status entry fails inside Submit and cannot see failures the worker finds later in the prefix; the next status entry will. - If the small deferral record itself cannot be allocated, that entry fails immediately and can be out of order. `startup_storage_worker_start` takes about 35 s on Windows against its 60 s timeout (the sweeps dominate). I can trim the sweep bounds if you prefer more headroom on slower runners.
chatgpt-codex-connector[bot commented 2026-11-24 12:03:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T11:03:58Z.

Code review location: src/startup_stubs/xcrdapi.cpp; line 662

@@ -583,42 +583,83 @@ void run_entry(Object* self, Entry& entry)
     }
 }
 
+// Stack committed up front for a queue worker. The thread decodes request buffers sized from request
+// fields, and when one allocation fails it also runs the exception unwinder and the failure log. Once
+// the system is out of commit a stack page that was never touched cannot be committed either, so the
+// stack is committed at creation (CreateThread without STACK_SIZE_PARAMS_ARE_A_RESERVATION treats the
+// size as the committed size; the reserved size stays the image default or larger).
+constexpr SIZE_T worker_stack_commit = 1u << 20;
+
+// Failure text is held in caller-provided storage: nothing here allocates.
+void copy_reason(char (&reason)[96], const char* text) noexcept
+{
+    std::size_t i = 0;
+    for (; text && text[i] && i + 1 < sizeof reason; ++i) reason[i] = text[i];
+    reason[i] = 0;
+}
+
+// Fails the entry that threw: the next status entry reports E_FAIL, the worker goes on with the queue.
+void fail_entry(Object* self, const Entry& entry, const char* reason) noexcept
+{
+    InterlockedIncrement(&requests_failed);
+    InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL));
+    static LONG reported;
+    if (InterlockedIncrement(&reported) <= 12)
+        log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), reason,
+            entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull);
+}
+
+DWORD WINAPI queue_worker(void* parameter)
+{
+    auto* const self = static_cast<Object*>(parameter);
+    QueueWork& work = *self->work;
+    for (;;) {
+        Entry entry;
+        {
+            std::unique_lock lock(work.mutex);
+            work.wake.wait(lock, [&] { return !work.submitted.empty(); });
+            entry = std::move(work.submitted.front());
+            work.submitted.pop_front();
+        }
+        // Buffers are sized from request fields; a failed allocation fails that request instead of
+        // ending the process (an exception leaving a thread calls terminate). The handlers only note
+        // the reason in a fixed buffer: the request's buffers are already freed when a handler runs,
+        // and the log is written after the handler has left, so no formatting runs while the
+        // exception is in flight on this stack.
+        char reason[96] = "";
+        bool failed = false;
+        try {
+            run_entry(self, entry);
+        } catch (const std::bad_alloc&) {
+            failed = true;
+            copy_reason(reason, "out of memory");
+        } catch (const std::exception& error) {
+            failed = true;
+            copy_reason(reason, error.what());
+        } catch (...) {
+            failed = true;
+            copy_reason(reason, "unknown exception");
+        }
+        if (failed) fail_entry(self, entry, reason);
+        {
+            const std::lock_guard guard(work.mutex);
+            if (work.submitted.empty()) {
+                work.cached_streams.clear();
+            }
+        }
+    }
+}
+
 QueueWork& work_of(Object* self)
 {
     static std::mutex create;
     const std::lock_guard guard(create);
     if (!self->work) {
         self->work = new QueueWork;
-        std::thread([self] {
-            QueueWork& work = *self->work;
-            for (;;) {
-                Entry entry;
-                {
-                    std::unique_lock lock(work.mutex);
-                    work.wake.wait(lock, [&] { return !work.submitted.empty(); });
-                    entry = std::move(work.submitted.front());
-                    work.submitted.pop_front();
-                }
-                // Buffers are sized from request fields; a failed allocation fails that request
-                // instead of ending the process (an exception leaving a thread calls terminate).
-                try {
-                    run_entry(self, entry);
-                } catch (const std::exception& error) {
-                    InterlockedIncrement(&requests_failed);
-                    InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL));
-                    static LONG reported;
-                    if (InterlockedIncrement(&reported) <= 12)
-                        log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), error.what(),
-                            entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull);
-                }
-                {
-                    const std::lock_guard guard(work.mutex);
-                    if (work.submitted.empty()) {
-                        work.cached_streams.clear();
-                    }
-                }
-            }
-        }).detach();
+        HANDLE worker = CreateThread(nullptr, worker_stack_commit, queue_worker, self, 0, nullptr);
+        if (!worker) worker = CreateThread(nullptr, 0, queue_worker, self, 0, nullptr);
+        if (worker) CloseHandle(worker);
+        else log("x2w-dstorage queue worker not started: error %lu", GetLastError());

P2 Badge Reject queue work when both worker creation attempts fail

If both CreateThread calls fail—for example, when the queue is first used under commit pressure—this only logs and returns the already-published self->work. push() and submit() then accept entries normally, but no thread drains submitted: status entries remain E_PENDING and fence signals never run. Because self->work stays non-null, later calls never retry even after resources recover. Unlike the previous std::thread constructor's synchronous failure, this silently turns the failure into an indefinite loading stall. Roll back the work state and propagate the startup failure, or explicitly fail affected requests, rather than accepting work without a consumer.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4679033208 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#discussion_r4679033208). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T11:03:58Z. **Code review location:** `src/startup_stubs/xcrdapi.cpp`; line 662 ~~~~diff @@ -583,42 +583,83 @@ void run_entry(Object* self, Entry& entry) } } +// Stack committed up front for a queue worker. The thread decodes request buffers sized from request +// fields, and when one allocation fails it also runs the exception unwinder and the failure log. Once +// the system is out of commit a stack page that was never touched cannot be committed either, so the +// stack is committed at creation (CreateThread without STACK_SIZE_PARAMS_ARE_A_RESERVATION treats the +// size as the committed size; the reserved size stays the image default or larger). +constexpr SIZE_T worker_stack_commit = 1u << 20; + +// Failure text is held in caller-provided storage: nothing here allocates. +void copy_reason(char (&reason)[96], const char* text) noexcept +{ + std::size_t i = 0; + for (; text && text[i] && i + 1 < sizeof reason; ++i) reason[i] = text[i]; + reason[i] = 0; +} + +// Fails the entry that threw: the next status entry reports E_FAIL, the worker goes on with the queue. +void fail_entry(Object* self, const Entry& entry, const char* reason) noexcept +{ + InterlockedIncrement(&requests_failed); + InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL)); + static LONG reported; + if (InterlockedIncrement(&reported) <= 12) + log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), reason, + entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull); +} + +DWORD WINAPI queue_worker(void* parameter) +{ + auto* const self = static_cast<Object*>(parameter); + QueueWork& work = *self->work; + for (;;) { + Entry entry; + { + std::unique_lock lock(work.mutex); + work.wake.wait(lock, [&] { return !work.submitted.empty(); }); + entry = std::move(work.submitted.front()); + work.submitted.pop_front(); + } + // Buffers are sized from request fields; a failed allocation fails that request instead of + // ending the process (an exception leaving a thread calls terminate). The handlers only note + // the reason in a fixed buffer: the request's buffers are already freed when a handler runs, + // and the log is written after the handler has left, so no formatting runs while the + // exception is in flight on this stack. + char reason[96] = ""; + bool failed = false; + try { + run_entry(self, entry); + } catch (const std::bad_alloc&) { + failed = true; + copy_reason(reason, "out of memory"); + } catch (const std::exception& error) { + failed = true; + copy_reason(reason, error.what()); + } catch (...) { + failed = true; + copy_reason(reason, "unknown exception"); + } + if (failed) fail_entry(self, entry, reason); + { + const std::lock_guard guard(work.mutex); + if (work.submitted.empty()) { + work.cached_streams.clear(); + } + } + } +} + QueueWork& work_of(Object* self) { static std::mutex create; const std::lock_guard guard(create); if (!self->work) { self->work = new QueueWork; - std::thread([self] { - QueueWork& work = *self->work; - for (;;) { - Entry entry; - { - std::unique_lock lock(work.mutex); - work.wake.wait(lock, [&] { return !work.submitted.empty(); }); - entry = std::move(work.submitted.front()); - work.submitted.pop_front(); - } - // Buffers are sized from request fields; a failed allocation fails that request - // instead of ending the process (an exception leaving a thread calls terminate). - try { - run_entry(self, entry); - } catch (const std::exception& error) { - InterlockedIncrement(&requests_failed); - InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL)); - static LONG reported; - if (InterlockedIncrement(&reported) <= 12) - log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), error.what(), - entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull); - } - { - const std::lock_guard guard(work.mutex); - if (work.submitted.empty()) { - work.cached_streams.clear(); - } - } - } - }).detach(); + HANDLE worker = CreateThread(nullptr, worker_stack_commit, queue_worker, self, 0, nullptr); + if (!worker) worker = CreateThread(nullptr, 0, queue_worker, self, 0, nullptr); + if (worker) CloseHandle(worker); + else log("x2w-dstorage queue worker not started: error %lu", GetLastError()); ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Reject queue work when both worker creation attempts fail** If both `CreateThread` calls fail—for example, when the queue is first used under commit pressure—this only logs and returns the already-published `self->work`. `push()` and `submit()` then accept entries normally, but no thread drains `submitted`: status entries remain `E_PENDING` and fence signals never run. Because `self->work` stays non-null, later calls never retry even after resources recover. Unlike the previous `std::thread` constructor's synchronous failure, this silently turns the failure into an indefinite loading stall. Roll back the work state and propagate the startup failure, or explicitly fail affected requests, rather than accepting work without a consumer. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-24 12:03:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:10:20Z.

Code review location: src/startup_stubs/xcrdapi.cpp; line 662

@@ -583,42 +583,83 @@ void run_entry(Object* self, Entry& entry)
     }
 }
 
+// Stack committed up front for a queue worker. The thread decodes request buffers sized from request
+// fields, and when one allocation fails it also runs the exception unwinder and the failure log. Once
+// the system is out of commit a stack page that was never touched cannot be committed either, so the
+// stack is committed at creation (CreateThread without STACK_SIZE_PARAMS_ARE_A_RESERVATION treats the
+// size as the committed size; the reserved size stays the image default or larger).
+constexpr SIZE_T worker_stack_commit = 1u << 20;
+
+// Failure text is held in caller-provided storage: nothing here allocates.
+void copy_reason(char (&reason)[96], const char* text) noexcept
+{
+    std::size_t i = 0;
+    for (; text && text[i] && i + 1 < sizeof reason; ++i) reason[i] = text[i];
+    reason[i] = 0;
+}
+
+// Fails the entry that threw: the next status entry reports E_FAIL, the worker goes on with the queue.
+void fail_entry(Object* self, const Entry& entry, const char* reason) noexcept
+{
+    InterlockedIncrement(&requests_failed);
+    InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL));
+    static LONG reported;
+    if (InterlockedIncrement(&reported) <= 12)
+        log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), reason,
+            entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull);
+}
+
+DWORD WINAPI queue_worker(void* parameter)
+{
+    auto* const self = static_cast<Object*>(parameter);
+    QueueWork& work = *self->work;
+    for (;;) {
+        Entry entry;
+        {
+            std::unique_lock lock(work.mutex);
+            work.wake.wait(lock, [&] { return !work.submitted.empty(); });
+            entry = std::move(work.submitted.front());
+            work.submitted.pop_front();
+        }
+        // Buffers are sized from request fields; a failed allocation fails that request instead of
+        // ending the process (an exception leaving a thread calls terminate). The handlers only note
+        // the reason in a fixed buffer: the request's buffers are already freed when a handler runs,
+        // and the log is written after the handler has left, so no formatting runs while the
+        // exception is in flight on this stack.
+        char reason[96] = "";
+        bool failed = false;
+        try {
+            run_entry(self, entry);
+        } catch (const std::bad_alloc&) {
+            failed = true;
+            copy_reason(reason, "out of memory");
+        } catch (const std::exception& error) {
+            failed = true;
+            copy_reason(reason, error.what());
+        } catch (...) {
+            failed = true;
+            copy_reason(reason, "unknown exception");
+        }
+        if (failed) fail_entry(self, entry, reason);
+        {
+            const std::lock_guard guard(work.mutex);
+            if (work.submitted.empty()) {
+                work.cached_streams.clear();
+            }
+        }
+    }
+}
+
 QueueWork& work_of(Object* self)
 {
     static std::mutex create;
     const std::lock_guard guard(create);
     if (!self->work) {
         self->work = new QueueWork;
-        std::thread([self] {
-            QueueWork& work = *self->work;
-            for (;;) {
-                Entry entry;
-                {
-                    std::unique_lock lock(work.mutex);
-                    work.wake.wait(lock, [&] { return !work.submitted.empty(); });
-                    entry = std::move(work.submitted.front());
-                    work.submitted.pop_front();
-                }
-                // Buffers are sized from request fields; a failed allocation fails that request
-                // instead of ending the process (an exception leaving a thread calls terminate).
-                try {
-                    run_entry(self, entry);
-                } catch (const std::exception& error) {
-                    InterlockedIncrement(&requests_failed);
-                    InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL));
-                    static LONG reported;
-                    if (InterlockedIncrement(&reported) <= 12)
-                        log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), error.what(),
-                            entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull);
-                }
-                {
-                    const std::lock_guard guard(work.mutex);
-                    if (work.submitted.empty()) {
-                        work.cached_streams.clear();
-                    }
-                }
-            }
-        }).detach();
+        HANDLE worker = CreateThread(nullptr, worker_stack_commit, queue_worker, self, 0, nullptr);
+        if (!worker) worker = CreateThread(nullptr, 0, queue_worker, self, 0, nullptr);
+        if (worker) CloseHandle(worker);
+        else log("x2w-dstorage queue worker not started: error %lu", GetLastError());

Fixed in 6bdd33c4: ensure_work() now allocates QueueWork with nothrow and creates the worker CREATE_SUSPENDED, only publishing self->work once a worker thread actually starts (deleting QueueWork and returning nullptr otherwise so later calls can retry). When ensure_work() returns nullptr, push() fails unstarted requests (E_OUTOFMEMORY on self->pending), completes status entries with E_OUTOFMEMORY instead of leaving E_PENDING, and signals fences immediately. Verified in startup_storage_alloc_failure (Debug & Release /O2 1/1 passed on Win2025).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4679108843 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#discussion_r4679108843). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T11:10:20Z. **Code review location:** `src/startup_stubs/xcrdapi.cpp`; line 662 ~~~~diff @@ -583,42 +583,83 @@ void run_entry(Object* self, Entry& entry) } } +// Stack committed up front for a queue worker. The thread decodes request buffers sized from request +// fields, and when one allocation fails it also runs the exception unwinder and the failure log. Once +// the system is out of commit a stack page that was never touched cannot be committed either, so the +// stack is committed at creation (CreateThread without STACK_SIZE_PARAMS_ARE_A_RESERVATION treats the +// size as the committed size; the reserved size stays the image default or larger). +constexpr SIZE_T worker_stack_commit = 1u << 20; + +// Failure text is held in caller-provided storage: nothing here allocates. +void copy_reason(char (&reason)[96], const char* text) noexcept +{ + std::size_t i = 0; + for (; text && text[i] && i + 1 < sizeof reason; ++i) reason[i] = text[i]; + reason[i] = 0; +} + +// Fails the entry that threw: the next status entry reports E_FAIL, the worker goes on with the queue. +void fail_entry(Object* self, const Entry& entry, const char* reason) noexcept +{ + InterlockedIncrement(&requests_failed); + InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL)); + static LONG reported; + if (InterlockedIncrement(&reported) <= 12) + log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), reason, + entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull); +} + +DWORD WINAPI queue_worker(void* parameter) +{ + auto* const self = static_cast<Object*>(parameter); + QueueWork& work = *self->work; + for (;;) { + Entry entry; + { + std::unique_lock lock(work.mutex); + work.wake.wait(lock, [&] { return !work.submitted.empty(); }); + entry = std::move(work.submitted.front()); + work.submitted.pop_front(); + } + // Buffers are sized from request fields; a failed allocation fails that request instead of + // ending the process (an exception leaving a thread calls terminate). The handlers only note + // the reason in a fixed buffer: the request's buffers are already freed when a handler runs, + // and the log is written after the handler has left, so no formatting runs while the + // exception is in flight on this stack. + char reason[96] = ""; + bool failed = false; + try { + run_entry(self, entry); + } catch (const std::bad_alloc&) { + failed = true; + copy_reason(reason, "out of memory"); + } catch (const std::exception& error) { + failed = true; + copy_reason(reason, error.what()); + } catch (...) { + failed = true; + copy_reason(reason, "unknown exception"); + } + if (failed) fail_entry(self, entry, reason); + { + const std::lock_guard guard(work.mutex); + if (work.submitted.empty()) { + work.cached_streams.clear(); + } + } + } +} + QueueWork& work_of(Object* self) { static std::mutex create; const std::lock_guard guard(create); if (!self->work) { self->work = new QueueWork; - std::thread([self] { - QueueWork& work = *self->work; - for (;;) { - Entry entry; - { - std::unique_lock lock(work.mutex); - work.wake.wait(lock, [&] { return !work.submitted.empty(); }); - entry = std::move(work.submitted.front()); - work.submitted.pop_front(); - } - // Buffers are sized from request fields; a failed allocation fails that request - // instead of ending the process (an exception leaving a thread calls terminate). - try { - run_entry(self, entry); - } catch (const std::exception& error) { - InterlockedIncrement(&requests_failed); - InterlockedExchange(&self->pending, static_cast<LONG>(E_FAIL)); - static LONG reported; - if (InterlockedIncrement(&reported) <= 12) - log("x2w-dstorage entry type %d failed: %s (options=0x%llx)", static_cast<int>(entry.type), error.what(), - entry.type == Entry::request ? *reinterpret_cast<const unsigned long long*>(entry.bytes) : 0ull); - } - { - const std::lock_guard guard(work.mutex); - if (work.submitted.empty()) { - work.cached_streams.clear(); - } - } - } - }).detach(); + HANDLE worker = CreateThread(nullptr, worker_stack_commit, queue_worker, self, 0, nullptr); + if (!worker) worker = CreateThread(nullptr, 0, queue_worker, self, 0, nullptr); + if (worker) CloseHandle(worker); + else log("x2w-dstorage queue worker not started: error %lu", GetLastError()); ~~~~ --- Fixed in 6bdd33c4: `ensure_work()` now allocates `QueueWork` with `nothrow` and creates the worker `CREATE_SUSPENDED`, only publishing `self->work` once a worker thread actually starts (deleting `QueueWork` and returning `nullptr` otherwise so later calls can retry). When `ensure_work()` returns `nullptr`, `push()` fails unstarted requests (`E_OUTOFMEMORY` on `self->pending`), completes status entries with `E_OUTOFMEMORY` instead of leaving `E_PENDING`, and signals fences immediately. Verified in `startup_storage_alloc_failure` (Debug & Release `/O2` 1/1 passed on Win2025).
R0Y00 commented 2026-11-24 13:00:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T12:30:23Z.

Review: COMMENTED


Release passes the three storage checks at this head. The remaining ordering hole is in submit(): after notifying the worker, Submit processes the failed suffix on its own thread. A status or fence in that suffix can complete while an earlier successfully submitted request is still running, and the suffix can consume the pending error before the worker reports the earlier request. Please serialize suffix completions behind the submitted prefix. A deterministic control can hold the prefix at an event, inject only the suffix allocation failure, and check that destination, status, and fence become visible in queue order.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039213777 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6039213777). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T12:30:23Z. **Review:** COMMENTED --- Release passes the three storage checks at this head. The remaining ordering hole is in submit(): after notifying the worker, Submit processes the failed suffix on its own thread. A status or fence in that suffix can complete while an earlier successfully submitted request is still running, and the suffix can consume the pending error before the worker reports the earlier request. Please serialize suffix completions behind the submitted prefix. A deterministic control can hold the prefix at an event, inject only the suffix allocation failure, and check that destination, status, and fence become visible in queue order.
tedin7 commented 2026-11-24 13:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:41:29Z.


Fixed in f500398e: Submit now waits, without allocating, until the worker has finished the submitted prefix before it completes the failed suffix (or the entries that could not be moved), so suffix statuses and fences become visible in queue order and see the prefix failures. A Submit made from the worker itself does not wait. startup_storage_worker_start has a new control (suffix_waits_for_prefix): the prefix is a fence held at an event inside the worker, only the suffix storage allocation fails, and the status and suffix fence must stay incomplete while the prefix is held, then complete after the prefix fence. The all-thread allocation sweep now counts only buffer-sized allocations on the worker, because a small one there is the MSVC debug container proxy inside a noexcept vector constructor (it aborted the Debug run at the previous head too).

Win2025 Debug and Release /O2: startup_storage_worker_start, startup_storage_alloc_failure and startup_storage_file_range pass 3/3 in both.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131787532 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7131787532). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:41:29Z. --- Fixed in f500398e: Submit now waits, without allocating, until the worker has finished the submitted prefix before it completes the failed suffix (or the entries that could not be moved), so suffix statuses and fences become visible in queue order and see the prefix failures. A Submit made from the worker itself does not wait. startup_storage_worker_start has a new control (suffix_waits_for_prefix): the prefix is a fence held at an event inside the worker, only the suffix storage allocation fails, and the status and suffix fence must stay incomplete while the prefix is held, then complete after the prefix fence. The all-thread allocation sweep now counts only buffer-sized allocations on the worker, because a small one there is the MSVC debug container proxy inside a noexcept vector constructor (it aborted the Debug run at the previous head too). Win2025 Debug and Release /O2: startup_storage_worker_start, startup_storage_alloc_failure and startup_storage_file_range pass 3/3 in both.
SimSalabimse commented 2026-11-24 13:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T12:53:57Z.


Retested on Windows 11 26200, MSVC 19.42, RTX 4070 Ti at f500398e: all three pass in both presets.

  • startup_storage_file_range: dev 0.05 s, release 0.03 s
  • startup_storage_alloc_failure: dev 0.15 s, release 0.11 s
  • startup_storage_worker_start: dev 36.40 s, release 36.37 s

The 1455 worker-start failure from my earlier run is gone.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132070344 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7132070344). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T12:53:57Z. --- Retested on Windows 11 26200, MSVC 19.42, RTX 4070 Ti at f500398e: all three pass in both presets. - startup_storage_file_range: dev 0.05 s, release 0.03 s - startup_storage_alloc_failure: dev 0.15 s, release 0.11 s - startup_storage_worker_start: dev 36.40 s, release 36.37 s The 1455 worker-start failure from my earlier run is gone. AI-Assisted
tedin7 commented 2026-11-24 13:00:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:56:00Z.


Thanks @SimSalabimse for retesting f500398e on Windows 11 26200 / MSVC 19.42 / RTX 4070 Ti across both Debug and Release presets!

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132116679 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7132116679). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:56:00Z. --- Thanks @SimSalabimse for retesting `f500398e` on Windows 11 26200 / MSVC 19.42 / RTX 4070 Ti across both Debug and Release presets!
R0Y00 commented 2026-11-24 14:02:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:07:20Z.

Review: COMMENTED


The held-prefix regression and all three Release cases pass on f500398e. The remaining gap is the submit cutoff: Submit records prefix_end, releases the queue lock, and later fail_waiting/fail_unrecorded drains the live queues. While the held prefix is running, a producer can enqueue the next batch and the first Submit can complete its status/fence before its own Submit. Please snapshot the batch at the cutoff and ensure ordered completion of that snapshot. Extend the held-prefix test with a second batch enqueued while the first prefix is held; its status and fence should stay pending through the first Submit. Also avoid waiting for prefix completion on the calling thread if the prefix can depend on work submitted after Submit returns. Microsoft DirectStorage guidance: https://github.com/microsoft/DirectStorage/blob/main/Docs/DeveloperGuidance.md

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039725768 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6039725768). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:07:20Z. **Review:** COMMENTED --- The held-prefix regression and all three Release cases pass on f500398e. The remaining gap is the submit cutoff: Submit records prefix_end, releases the queue lock, and later fail_waiting/fail_unrecorded drains the live queues. While the held prefix is running, a producer can enqueue the next batch and the first Submit can complete its status/fence before its own Submit. Please snapshot the batch at the cutoff and ensure ordered completion of that snapshot. Extend the held-prefix test with a second batch enqueued while the first prefix is held; its status and fence should stay pending through the first Submit. Also avoid waiting for prefix completion on the calling thread if the prefix can depend on work submitted after Submit returns. Microsoft DirectStorage guidance: https://github.com/microsoft/DirectStorage/blob/main/Docs/DeveloperGuidance.md
R0Y00 commented 2026-11-24 14:02:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:25:37Z.

Review: COMMENTED


Release passes the three storage cases on this head, including the new two-batch cutoff control. One remaining lock issue is in complete_deferred: the completion mutex is held while fail_unstarted calls the fence, and Submit can also enter complete_deferred. This holds a queue lock across a caller-supplied operation and can block a submitting thread behind that operation, or deadlock a callback that submits a deferred entry to the same queue. Please keep one completion owner and invoke fences without holding the serialization mutex. An event-gated fence plus a second Submit that returns while the fence is held can pin this behavior.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039984978 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6039984978). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:25:37Z. **Review:** COMMENTED --- Release passes the three storage cases on this head, including the new two-batch cutoff control. One remaining lock issue is in complete_deferred: the completion mutex is held while fail_unstarted calls the fence, and Submit can also enter complete_deferred. This holds a queue lock across a caller-supplied operation and can block a submitting thread behind that operation, or deadlock a callback that submits a deferred entry to the same queue. Please keep one completion owner and invoke fences without holding the serialization mutex. An event-gated fence plus a second Submit that returns while the fence is held can pin this behavior.
R0Y00 commented 2026-11-24 14:02:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:48:21Z.

Review: COMMENTED


All three Release storage tests pass on 0b1f880b. The completion flag resolves the lock held across a fence. One ownership case remains: if a Submit thread owns a ready deferred fence and its signal is held, the worker can see completing=true, return from complete_deferred, and dequeue a newer submitted status or fence. Make the deferred and normal completions use the same order. Extend the event control to hold the deferred fence itself and verify that a normal fence from a later Submit cannot signal until it is released.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6040349263 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6040349263). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:48:21Z. **Review:** COMMENTED --- All three Release storage tests pass on 0b1f880b. The completion flag resolves the lock held across a fence. One ownership case remains: if a Submit thread owns a ready deferred fence and its signal is held, the worker can see completing=true, return from complete_deferred, and dequeue a newer submitted status or fence. Make the deferred and normal completions use the same order. Extend the event control to hold the deferred fence itself and verify that a normal fence from a later Submit cannot signal until it is released.
tedin7 commented 2026-11-24 14:03:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:11:27Z.


Fixed in 9bb7e5ec: Submit now snapshots the failed entries at its cutoff, under the queue lock. That covers the stored entries it could not move and the unrecorded ones. The worker completes the snapshot right after it finishes that Submit's prefix. Snapshots are ordered by Submit, and within one Submit the stored entries come before the unrecorded ones. A later batch enqueued while the prefix is held can no longer be drained or completed by the first Submit.

Submit no longer waits for the prefix on the calling thread, so a prefix that depends on work submitted after Submit returns cannot deadlock it. The snapshot reuses the existing records and allocates nothing. If the snapshot storage itself cannot grow, Submit falls back to the earlier wait-then-fail path, which stays in order.

suffix_waits_for_prefix now holds the prefix at the event and requires the first Submit to return. It then enqueues and submits a second batch (status index 1 plus a fence) while the prefix is held. It checks that both statuses and both extra fences stay pending, and that the prefix, suffix and second-batch fences complete in queue order after release.

Windows Server 2025 (Build 26100, MSVC 14.44), startup_storage_(worker_start|alloc_failure|file_range):

  • Debug (dev): 3/3 passed.
  • Release /O2 (release): 3/3 passed.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132476623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7132476623). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T13:11:27Z. --- Fixed in 9bb7e5ec: Submit now snapshots the failed entries at its cutoff, under the queue lock. That covers the stored entries it could not move and the unrecorded ones. The worker completes the snapshot right after it finishes that Submit's prefix. Snapshots are ordered by Submit, and within one Submit the stored entries come before the unrecorded ones. A later batch enqueued while the prefix is held can no longer be drained or completed by the first Submit. Submit no longer waits for the prefix on the calling thread, so a prefix that depends on work submitted after Submit returns cannot deadlock it. The snapshot reuses the existing records and allocates nothing. If the snapshot storage itself cannot grow, Submit falls back to the earlier wait-then-fail path, which stays in order. `suffix_waits_for_prefix` now holds the prefix at the event and requires the first Submit to return. It then enqueues and submits a second batch (status index 1 plus a fence) while the prefix is held. It checks that both statuses and both extra fences stay pending, and that the prefix, suffix and second-batch fences complete in queue order after release. Windows Server 2025 (Build 26100, MSVC 14.44), `startup_storage_(worker_start|alloc_failure|file_range)`: - Debug (`dev`): 3/3 passed. - Release `/O2` (`release`): 3/3 passed.
tedin7 commented 2026-11-24 14:03:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:36:27Z.


Fixed in 0b1f880b: complete_deferred no longer holds a mutex across fences. A single completion owner (a flag under the queue lock) takes the snapshot entries, runs fail_unstarted with no lock held, and hands ownership back only when nothing is left; a thread that finds an owner returns at once, so Submit never waits behind a caller-supplied fence and a fence callback that submits a deferred entry cannot deadlock. The regression in tests/startup_storage_alloc_failure.cpp gates a fence on an event, runs a second Submit with a new deferred entry while the fence is held, requires it to return, and requires its status to fail after the fence is released.

Win2025 at 0b1f880b: Debug (dev) startup_storage_(worker_start|alloc_failure|file_range) 3/3 passed; Release /O2 3/3 passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133072747 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7133072747). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T13:36:27Z. --- Fixed in 0b1f880b: complete_deferred no longer holds a mutex across fences. A single completion owner (a flag under the queue lock) takes the snapshot entries, runs fail_unstarted with no lock held, and hands ownership back only when nothing is left; a thread that finds an owner returns at once, so Submit never waits behind a caller-supplied fence and a fence callback that submits a deferred entry cannot deadlock. The regression in tests/startup_storage_alloc_failure.cpp gates a fence on an event, runs a second Submit with a new deferred entry while the fence is held, requires it to return, and requires its status to fail after the fence is released. Win2025 at 0b1f880b: Debug (dev) startup_storage_(worker_start|alloc_failure|file_range) 3/3 passed; Release /O2 3/3 passed.
SimSalabimse commented 2026-11-24 14:03:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T13:56:03Z.


Retested at 0b1f880b on Windows 11 26200, MSVC 19.42, RTX 4070 Ti (driver 621.35).

  • dev: file_range 0.05 s, alloc_failure 0.16 s, worker_start 36.49 s, all pass (ctest exit 0)
  • release: file_range and worker_start pass, but startup_storage_alloc_failure logged "queue worker not started: error 1455" and then segfaulted (ctest exit 8). It passed when rerun alone, so the 1455 looks like memory pressure from parallel builds, but the segfault after a failed worker start looks like a missing error path.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133558886 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7133558886). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T13:56:03Z. --- Retested at 0b1f880b on Windows 11 26200, MSVC 19.42, RTX 4070 Ti (driver 621.35). - dev: file_range 0.05 s, alloc_failure 0.16 s, worker_start 36.49 s, all pass (ctest exit 0) - release: file_range and worker_start pass, but startup_storage_alloc_failure logged "queue worker not started: error 1455" and then segfaulted (ctest exit 8). It passed when rerun alone, so the 1455 looks like memory pressure from parallel builds, but the segfault after a failed worker start looks like a missing error path. AI-Assisted
tedin7 commented 2026-11-24 15:02:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:18:31Z.


@SimSalabimse thank you for the 0b1f880b run on the RTX 4070 Ti. The error 1455 on startup_storage_alloc_failure under parallel builds is memory pressure, as you suspected. The test passes when it runs alone.

@R0Y00 Fixed in 56ff9b20: the worker no longer starts a newer submitted status or fence while snapshot completions of an earlier Submit are ready or owned by another thread. The worker waits until that owner finishes, and the owner wakes it on release. Deferred and normal completions now use the same order.

startup_storage_worker_start has a new stage, suffix_waits_for_deferred_fence. It holds the deferred fence itself at an event, then enqueues and submits a later batch. That batch's status entry and normal fence must stay unsignaled until the event is released, and then everything completes in queue order.

Windows Server 2025 (MSVC 14.44, WARP) at 56ff9b20:

  • Debug: startup_storage_file_range, startup_storage_alloc_failure and startup_storage_worker_start pass, 3/3.
  • Release /O2: the same three tests pass, 3/3.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134164834 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7134164834). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:18:31Z. --- @SimSalabimse thank you for the `0b1f880b` run on the RTX 4070 Ti. The error 1455 on `startup_storage_alloc_failure` under parallel builds is memory pressure, as you suspected. The test passes when it runs alone. @R0Y00 Fixed in 56ff9b20: the worker no longer starts a newer submitted status or fence while snapshot completions of an earlier Submit are ready or owned by another thread. The worker waits until that owner finishes, and the owner wakes it on release. Deferred and normal completions now use the same order. `startup_storage_worker_start` has a new stage, `suffix_waits_for_deferred_fence`. It holds the deferred fence itself at an event, then enqueues and submits a later batch. That batch's status entry and normal fence must stay unsignaled until the event is released, and then everything completes in queue order. Windows Server 2025 (MSVC 14.44, WARP) at 56ff9b20: - Debug: `startup_storage_file_range`, `startup_storage_alloc_failure` and `startup_storage_worker_start` pass, 3/3. - Release `/O2`: the same three tests pass, 3/3. AI-Assisted
R0Y00 commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:28:46Z.


Retested 56ff9b20 on Windows x64 Release (MSVC 19.51). startup_storage_file_range and startup_storage_worker_start passed, including suffix_waits_for_deferred_fence. During the same CTest run, with another build active, startup_storage_alloc_failure crashed after three worker creation failures with Win32 1455, matching SimSalabimse. Three isolated repeats then passed. Keep the PR open until the low-commit path can complete the failed status and fence without an access violation or stack overflow. Please capture the exception code and first frame in the source-built fixture and cover that failure deterministically if possible. The ordered-completion fix should stay.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134441060 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7134441060). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:28:46Z. --- Retested 56ff9b20 on Windows x64 Release (MSVC 19.51). startup_storage_file_range and startup_storage_worker_start passed, including suffix_waits_for_deferred_fence. During the same CTest run, with another build active, startup_storage_alloc_failure crashed after three worker creation failures with Win32 1455, matching SimSalabimse. Three isolated repeats then passed. Keep the PR open until the low-commit path can complete the failed status and fence without an access violation or stack overflow. Please capture the exception code and first frame in the source-built fixture and cover that failure deterministically if possible. The ordered-completion fix should stay.
tedin7 commented 2026-11-24 15:02:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:54:18Z.


@R0Y00 Updated in 5fad2caf4161f2ec3ad14a28c9bd2a800aca8015 (the ordered-completion fix and suffix_waits_for_deferred_fence are untouched).

What changed in tests/startup_storage_alloc_failure.cpp

  • Deterministic Win32 1455 (ERROR_COMMITMENT_LIMIT) coverage via a CreateThread IAT hook on XCRDAPI.dll (no real memory pressure needed):
    1. Three failures then start: three Enqueue* calls each fail both CreateThread attempts with 1455 (verified against X2W_TRAP_LOG: 3x queue worker not started: error 1455), then Submit starts the worker and completes the batch in order.
    2. Default-stack fallback: the committed-stack CreateThread call fails with 1455 and the default-stack fallback succeeds.
    3. Worker never starts + recovery: all CreateThread calls fail across two batches and an empty Submit; status entries complete in queue order with E_OUTOFMEMORY, fences signal only after their preceding status entries, destinations remain untouched, and the same queue recovers once CreateThread succeeds again.
  • Submit-thread stack hardening: the real-pressure submit threads now pre-commit a 256 KiB stack at creation and call SetThreadStackGuarantee (64 KiB) so they do not rely on growing the stack after commit is exhausted.
  • Allocation-free crash diagnostics: an UnhandledExceptionFilter using only static buffers prints the exception code, faulting address (plus read/write target on access violation), and up to 8 unwound x64 frames (module+offset via RtlLookupFunctionEntry/RtlVirtualUnwind) to stderr, then exits with 0xE1410.

Transparency on the concurrent-build crash

The intermittent crash under a concurrent build did not reproduce on our Windows Server 2025 VM (neither before nor after 5fad2caf). If it triggers again under concurrent build load on MSVC 19.51, the fixture will now record the exception code and first unwound frames on stderr (exit 0xE1410) so we can pinpoint the exact fault.

Verification at 5fad2caf (Windows Server 2025 Build 26100, MSVC 14.44.35207, D3D12 WARP, 0 warnings)

  • Debug (--preset dev): startup_storage_file_range (0.01s), startup_storage_alloc_failure (0.11s), startup_storage_worker_start (37.04s) — 3/3 passed; 2 additional startup_storage_alloc_failure repeats passed (0.11s, 0.08s).
  • Release /O2 (--preset release): startup_storage_file_range (0.01s), startup_storage_alloc_failure (0.12s), startup_storage_worker_start (36.82s) — 3/3 passed; 2 additional startup_storage_alloc_failure repeats passed (0.12s, 0.11s).
  • GitHub CI: 3/3 checks green (Assemble and translate gfx1013 fixtures, Build and test on Windows, Run platform-independent Python checks on Linux).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135139104 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7135139104). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:54:18Z. --- @R0Y00 Updated in `5fad2caf4161f2ec3ad14a28c9bd2a800aca8015` (the ordered-completion fix and `suffix_waits_for_deferred_fence` are untouched). ### What changed in `tests/startup_storage_alloc_failure.cpp` - **Deterministic Win32 1455 (`ERROR_COMMITMENT_LIMIT`) coverage** via a `CreateThread` IAT hook on `XCRDAPI.dll` (no real memory pressure needed): 1. **Three failures then start**: three `Enqueue*` calls each fail both `CreateThread` attempts with 1455 (verified against `X2W_TRAP_LOG`: 3x `queue worker not started: error 1455`), then `Submit` starts the worker and completes the batch in order. 2. **Default-stack fallback**: the committed-stack `CreateThread` call fails with 1455 and the default-stack fallback succeeds. 3. **Worker never starts + recovery**: all `CreateThread` calls fail across two batches and an empty `Submit`; status entries complete in queue order with `E_OUTOFMEMORY`, fences signal only after their preceding status entries, destinations remain untouched, and the same queue recovers once `CreateThread` succeeds again. - **Submit-thread stack hardening**: the real-pressure submit threads now pre-commit a `256 KiB` stack at creation and call `SetThreadStackGuarantee` (`64 KiB`) so they do not rely on growing the stack after commit is exhausted. - **Allocation-free crash diagnostics**: an `UnhandledExceptionFilter` using only static buffers prints the exception code, faulting address (plus read/write target on access violation), and up to 8 unwound x64 frames (`module+offset` via `RtlLookupFunctionEntry`/`RtlVirtualUnwind`) to `stderr`, then exits with `0xE1410`. ### Transparency on the concurrent-build crash The intermittent crash under a concurrent build did not reproduce on our Windows Server 2025 VM (neither before nor after `5fad2caf`). If it triggers again under concurrent build load on MSVC 19.51, the fixture will now record the exception code and first unwound frames on `stderr` (exit `0xE1410`) so we can pinpoint the exact fault. ### Verification at `5fad2caf` (Windows Server 2025 Build 26100, MSVC 14.44.35207, D3D12 WARP, 0 warnings) - **Debug (`--preset dev`)**: `startup_storage_file_range` (`0.01s`), `startup_storage_alloc_failure` (`0.11s`), `startup_storage_worker_start` (`37.04s`) — **3/3 passed**; 2 additional `startup_storage_alloc_failure` repeats passed (`0.11s`, `0.08s`). - **Release `/O2` (`--preset release`)**: `startup_storage_file_range` (`0.01s`), `startup_storage_alloc_failure` (`0.12s`), `startup_storage_worker_start` (`36.82s`) — **3/3 passed**; 2 additional `startup_storage_alloc_failure` repeats passed (`0.12s`, `0.11s`). - **GitHub CI**: 3/3 checks green (`Assemble and translate gfx1013 fixtures`, `Build and test on Windows`, `Run platform-independent Python checks on Linux`). AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 16:02:56 +00:00
R0Y00 commented 2026-11-24 16:02:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T15:17:21Z.

Review: APPROVED


Windows Release at 5fad2caf passed startup_storage_file_range, startup_storage_alloc_failure and startup_storage_worker_start (3/3). The deterministic worker-start failures cover completion order, untouched output and recovery, and the held deferred fence check still passes. The previous real-pressure crash did not recur in this run. The fixture now pre-commits the submitter stacks and reports a diagnostic if it recurs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041998145 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#pullrequestreview-6041998145). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T15:17:21Z. **Review:** APPROVED --- Windows Release at 5fad2caf passed startup_storage_file_range, startup_storage_alloc_failure and startup_storage_worker_start (3/3). The deterministic worker-start failures cover completion order, untouched output and recovery, and the held deferred fence check still passes. The previous real-pressure crash did not recur in this run. The fixture now pre-commits the submitter stacks and reports a diagnostic if it recurs.
SimSalabimse commented 2026-11-24 16:03:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-24T15:34:51Z.


Retest of 5fad2caf4161f2ec3ad14a28c9bd2a800aca8015 on Windows 11 26200, MSVC 19.42.34435, RTX 4070 Ti driver 621.35.

dev

ctest --preset dev --no-tests=error -R '^startup_storage_' --output-on-failure

Exit code 0. 3 tests passed, 0 failed. Total 37.29 sec.

Test Result Time
startup_storage_file_range Passed 0.06 sec
startup_storage_alloc_failure Passed 0.22 sec
startup_storage_worker_start Passed 37.00 sec

release

ctest --preset release --no-tests=error -R '^startup_storage_' --output-on-failure

Exit code 0. 3 tests passed, 0 failed. Total 37.21 sec.

Test Result Time
startup_storage_file_range Passed 0.04 sec
startup_storage_alloc_failure Passed 0.18 sec
startup_storage_worker_start Passed 36.97 sec

The filter matched those three tests. startup_storage_directory_batch was not registered because INTAKE_PYTHON was absent.

Pressure

startup_storage_alloc_failure ran on the release preset while a second checkout of the same commit was compiling cmake --build --preset release --clean-first. ctest started with 19 cl.exe processes and ended with 34, and that build was still running.

ctest --preset release --no-tests=error -R '^startup_storage_alloc_failure$' --output-on-failure --repeat until-fail:5

Exit code 0. Five passes: 0.14 sec, 0.14 sec, 0.14 sec, 0.27 sec, 0.34 sec. Total 1.08 sec.

The ctest output had no error 1455 lines and no crash report. The test did not exit 0xE1410.

Isolated controls

The same release command, one run at a time, after that build had exited and with no cl.exe running:

Run Exit code Time
1 0 0.13 sec
2 0 0.13 sec
3 0 0.12 sec

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7136266530 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1410#issuecomment-7136266530). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-24T15:34:51Z. --- Retest of `5fad2caf4161f2ec3ad14a28c9bd2a800aca8015` on Windows 11 26200, MSVC 19.42.34435, RTX 4070 Ti driver 621.35. ## dev `ctest --preset dev --no-tests=error -R '^startup_storage_' --output-on-failure` Exit code 0. 3 tests passed, 0 failed. Total 37.29 sec. | Test | Result | Time | |---|---|---| | `startup_storage_file_range` | Passed | 0.06 sec | | `startup_storage_alloc_failure` | Passed | 0.22 sec | | `startup_storage_worker_start` | Passed | 37.00 sec | ## release `ctest --preset release --no-tests=error -R '^startup_storage_' --output-on-failure` Exit code 0. 3 tests passed, 0 failed. Total 37.21 sec. | Test | Result | Time | |---|---|---| | `startup_storage_file_range` | Passed | 0.04 sec | | `startup_storage_alloc_failure` | Passed | 0.18 sec | | `startup_storage_worker_start` | Passed | 36.97 sec | The filter matched those three tests. `startup_storage_directory_batch` was not registered because `INTAKE_PYTHON` was absent. ## Pressure `startup_storage_alloc_failure` ran on the release preset while a second checkout of the same commit was compiling `cmake --build --preset release --clean-first`. ctest started with 19 `cl.exe` processes and ended with 34, and that build was still running. `ctest --preset release --no-tests=error -R '^startup_storage_alloc_failure$' --output-on-failure --repeat until-fail:5` Exit code 0. Five passes: 0.14 sec, 0.14 sec, 0.14 sec, 0.27 sec, 0.34 sec. Total 1.08 sec. The ctest output had no `error 1455` lines and no crash report. The test did not exit `0xE1410`. ## Isolated controls The same release command, one run at a time, after that build had exited and with no `cl.exe` running: | Run | Exit code | Time | |---|---|---| | 1 | 0 | 0.13 sec | | 2 | 0 | 0.13 sec | | 3 | 0 | 0.12 sec | AI-Assisted
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1403
No description provided.