test: spawn pipeline library host steps without a command shell #1466

Closed
leonida/mandy
whoalin1 wants to merge 0 commits from plh-crash-fix into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

whoalin1 commented 2026-11-25 00:49:18 +00:00

Claimed in the coordination issue: https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7148908675

What

d3d12_pipeline_library_host_test ran each host step through _popen, which resolves the command shell via COMSPEC and a PATH search for cmd.exe — and the UCRT fast-fails the calling process (0xc0000409) when neither finds one. Shells with a stripped environment (agent shells, or ctest inheriting one without System32 on PATH) crashed the whole test at the first host step in ~0.7 s, while cmd.exe passed. GPU-independent; reproduced identically on RTX 4070 SUPER and AMD iGPU paths.

Repro: a 15-line _popen("whoami.exe","r") program crashes with 0xc0000409 under the stripped env; adding only ComSpec or only System32 to PATH each make it pass.

Fix: spawn the --host-step child with CreateProcessA + anonymous pipe (CreatePipe, STARTF_USESTDHANDLES, drain ReadFile until EOF, then WaitForSingleObject — correct order, no pipe deadlock). No shell is involved, so no environment can fast-fail the test. CREATE_NO_WINDOW included.

Spawn/infrastructure failures (CreatePipe/CreateProcessA/ReadFile/WaitForSingleObject) now return a kNoChild sentinel — the same pattern as d3d12_residency_test.cpp — that fails the comparison with GetLastError diagnostics, instead of the old kFaulted path that could have produced a vacuous 0 steps compared, 0 mismatches pass.

Tested

  • ctest -R d3d12_pipeline_library_host under the previously-crashing stripped env (no COMSPEC, PATH without System32): Passed, 10.85 s (was 0.74 s crash).
  • Normal env: Passed — 72 steps compared with the host (22 more not compared), 0 mismatches, identical to the cmd.exe baseline.
  • AMD Radeon iGPU env: Passed, 0 mismatches.
  • Forced spawn failure (exe renamed mid-run → CreateProcessA ERROR_FILE_NOT_FOUND): test correctly fails with GetLastError 2 diagnostics — not a vacuous pass.
  • Full build clean (Ninja, RelWithDebInfo).

AI-assisted (Devin).

Claimed in the coordination issue: https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7148908675 ## What `d3d12_pipeline_library_host_test` ran each host step through `_popen`, which resolves the command shell via `COMSPEC` and a PATH search for `cmd.exe` — and the UCRT **fast-fails the calling process (0xc0000409)** when neither finds one. Shells with a stripped environment (agent shells, or ctest inheriting one without `System32` on PATH) crashed the whole test at the first host step in ~0.7 s, while `cmd.exe` passed. GPU-independent; reproduced identically on RTX 4070 SUPER and AMD iGPU paths. Repro: a 15-line `_popen("whoami.exe","r")` program crashes with 0xc0000409 under the stripped env; adding only `ComSpec` **or** only `System32` to PATH each make it pass. Fix: spawn the `--host-step` child with `CreateProcessA` + anonymous pipe (`CreatePipe`, `STARTF_USESTDHANDLES`, drain `ReadFile` until EOF, then `WaitForSingleObject` — correct order, no pipe deadlock). No shell is involved, so no environment can fast-fail the test. `CREATE_NO_WINDOW` included. Spawn/infrastructure failures (CreatePipe/CreateProcessA/ReadFile/WaitForSingleObject) now return a `kNoChild` sentinel — the same pattern as `d3d12_residency_test.cpp` — that **fails** the comparison with `GetLastError` diagnostics, instead of the old `kFaulted` path that could have produced a vacuous `0 steps compared, 0 mismatches` pass. ## Tested - `ctest -R d3d12_pipeline_library_host` under the previously-crashing stripped env (no COMSPEC, PATH without System32): **Passed, 10.85 s** (was 0.74 s crash). - Normal env: Passed — `72 steps compared with the host (22 more not compared), 0 mismatches`, identical to the cmd.exe baseline. - AMD Radeon iGPU env: Passed, 0 mismatches. - Forced spawn failure (exe renamed mid-run → CreateProcessA ERROR_FILE_NOT_FOUND): test correctly **fails** with `GetLastError 2` diagnostics — not a vacuous pass. - Full build clean (Ninja, RelWithDebInfo). AI-assisted (Devin).
Gefik23 commented 2026-11-25 07:04:19 +00:00

Tested 22b5ca682 on NVIDIA GeForce RTX 4060, driver 617.42, AMD Ryzen 5 7500F, Windows 11 Pro build 26200, native Windows: pass.

Built at this head with scripts\build_runtime.ps1 (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0).

  • ctest -R pipeline_library_host -V: passed in 10.48 s, "72 steps compared with the host (22 more not compared), 0 mismatches". Normal environment only; the stripped-environment case (no COMSPEC, PATH without System32) was not reproduced here.
  • Full ctest -C RelWithDebInfo: 308/308 passed (game-data tests skipped, LEONIDA_GAME_DIR unset).

AI-assisted (Claude Code ran the build and tests). No game files.

Tested 22b5ca682 on NVIDIA GeForce RTX 4060, driver 617.42, AMD Ryzen 5 7500F, Windows 11 Pro build 26200, native Windows: pass. Built at this head with `scripts\build_runtime.ps1` (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0). - `ctest -R pipeline_library_host -V`: passed in 10.48 s, "72 steps compared with the host (22 more not compared), 0 mismatches". Normal environment only; the stripped-environment case (no COMSPEC, PATH without System32) was not reproduced here. - Full `ctest -C RelWithDebInfo`: 308/308 passed (game-data tests skipped, LEONIDA_GAME_DIR unset). AI-assisted (Claude Code ran the build and tests). No game files.
whoalin1 commented 2026-11-25 20:07:31 +00:00

Rebased cleanly onto current main (db1a22d29) as cf728055f to refresh the stale CI baseline; no conflicts. The branch remains the pipeline-library-host CreateProcess fix. AI-assisted with Devin.

Rebased cleanly onto current main (`db1a22d29`) as `cf728055f` to refresh the stale CI baseline; no conflicts. The branch remains the pipeline-library-host CreateProcess fix. AI-assisted with Devin.
OreoFR commented 2026-11-28 21:51:40 +00:00

Verified by OreoFR

  • Base: main c1ecf04ed + PR head cf728055f; green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R ^d3d12_pipeline_library_host$
  • Red on main: OK
  • Green with the PR: OK
  • Verdict: NO RED (test-only PR; here _popen finds cmd.exe, the environment-without-COMSPEC case is not reproduced)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `cf728055f`; green run in a merge package of 12 PRs, no new ctest failure vs main - Test: `ctest -R ^d3d12_pipeline_library_host$` - Red on main: OK - Green with the PR: OK - Verdict: NO RED (test-only PR; here _popen finds cmd.exe, the environment-without-COMSPEC case is not reproduced) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-29 02:36:10 +00:00

Independent Hardware & Stripped-Environment Red/Green Verification (RTX 3090, Windows 11)

  • Tested merge: origin/main (04f484006e) + PR #1466 (cf728055fc) — clean 3-way merge (0 conflicts).
  • Environment: NVIDIA GeForce RTX 3090 (24 GB, Resizable BAR), Windows 11, Visual Studio 2022 (MSVC 19.44 RelWithDebInfo), Vulkan SDK + VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1).

Red -> Green Results

  1. Red on unpatched origin/main (04f484006e, stripped shell environment):
    • Spawned d3d12_pipeline_library_host_test.exe with COMSPEC unset and System32 omitted from PATH (retaining only runtime/SDK library directories).
    • Reproduced the UCRT _popen failure immediately at the first --host-step invocation: process terminated with exit code 3221226505 (0xC0000409, STATUS_STACK_BUFFER_OVERRUN / __fastfail) before completing a single host comparison.
  2. Green on origin/main + #1466 (cf728055fc):
    • Stripped environment (COMSPEC unset, System32 omitted from PATH, LEONIDA_VK_VALIDATION=1): d3d12_pipeline_library_host_test.exe exited 0 (pipeline library: 72 steps compared with the host (22 more not compared), 0 mismatches, 0 Vulkan validation errors).
    • Standard CTest (ctest -C RelWithDebInfo -R "^d3d12_pipeline_library_host$" -V, LEONIDA_VK_VALIDATION=1): Passed (24.42 s, 72 steps compared with the host (22 more not compared), 0 mismatches, 0 Vulkan validation errors).

Code & Hygiene Audit

  • Verified pipe lifecycle and handle hygiene in isolated(): write_pipe and process.hThread are closed in the parent before draining ReadFile to EOF / ERROR_BROKEN_PIPE, preventing pipe buffer deadlocks before WaitForSingleObject, and infrastructure spawn/pipe/wait failures report GetLastError() via kNoChild (0xC41DFA11ull) so broken child launches fail EXPECT(theirs.values[i] != kNoChild) instead of being silently skipped as kFaulted.
  • python -I scripts/check_no_game_data.py runtime/test/d3d12_pipeline_library_host_test.cpp: passed (0 issues). No game files used.

AI-assisted: yes

### Independent Hardware & Stripped-Environment Red/Green Verification (RTX 3090, Windows 11) - **Tested merge:** `origin/main` (`04f484006e`) + PR `#1466` (`cf728055fc`) — clean 3-way merge (`0` conflicts). - **Environment:** NVIDIA GeForce RTX 3090 (24 GB, Resizable BAR), Windows 11, Visual Studio 2022 (MSVC 19.44 `RelWithDebInfo`), Vulkan SDK + `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`). #### Red -> Green Results 1. **Red on unpatched `origin/main` (`04f484006e`, stripped shell environment):** - Spawned `d3d12_pipeline_library_host_test.exe` with `COMSPEC` unset and `System32` omitted from `PATH` (retaining only runtime/SDK library directories). - Reproduced the UCRT `_popen` failure immediately at the first `--host-step` invocation: process terminated with exit code **`3221226505` (`0xC0000409`, `STATUS_STACK_BUFFER_OVERRUN` / `__fastfail`)** before completing a single host comparison. 2. **Green on `origin/main` + `#1466` (`cf728055fc`):** - **Stripped environment (`COMSPEC` unset, `System32` omitted from `PATH`, `LEONIDA_VK_VALIDATION=1`):** `d3d12_pipeline_library_host_test.exe` exited **`0`** (`pipeline library: 72 steps compared with the host (22 more not compared), 0 mismatches`, `0` Vulkan validation errors). - **Standard CTest (`ctest -C RelWithDebInfo -R "^d3d12_pipeline_library_host$" -V`, `LEONIDA_VK_VALIDATION=1`):** **Passed** (`24.42 s`, `72 steps compared with the host (22 more not compared), 0 mismatches`, `0` Vulkan validation errors). #### Code & Hygiene Audit - Verified pipe lifecycle and handle hygiene in `isolated()`: `write_pipe` and `process.hThread` are closed in the parent before draining `ReadFile` to EOF / `ERROR_BROKEN_PIPE`, preventing pipe buffer deadlocks before `WaitForSingleObject`, and infrastructure spawn/pipe/wait failures report `GetLastError()` via `kNoChild` (`0xC41DFA11ull`) so broken child launches fail `EXPECT(theirs.values[i] != kNoChild)` instead of being silently skipped as `kFaulted`. - `python -I scripts/check_no_game_data.py runtime/test/d3d12_pipeline_library_host_test.cpp`: passed (`0` issues). No game files used. AI-assisted: yes
TheGeogeo commented 2026-11-29 14:18:08 +00:00

Ready for testing: merges cleanly with main 3535eb5c4. Not in main yet: git cherry finds 1 commit(s) not there, and 1 of the 51 lines it adds are already present. No duplicate found: it carries no claim ID, and no other open pull request has the same title.

AI-assisted (Claude Code).

Ready for testing: merges cleanly with `main` `3535eb5c4`. Not in `main` yet: `git cherry` finds 1 commit(s) not there, and 1 of the 51 lines it adds are already present. No duplicate found: it carries no claim ID, and no other open pull request has the same title. AI-assisted (Claude Code).
enlight3d commented 2026-11-29 15:44:12 +00:00

RUN report for #1466 (test: spawn pipeline library host steps without a command shell)

Kind: runtime C++, test only (runtime/test/d3d12_pipeline_library_host_test.cpp); no non-test change exists to revert, so the red is the old test file against the same trigger.

Heads: PR head cf728055f, based on db1a22d29; origin/main c22a0a732 (merged locally with git merge --no-edit --no-ff, clean, 1 file).

Commands (VS 2022 Build Tools env from vcvars64, VS cmake + ninja, -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON, SDL3 static via SDL3_DIR, 8 jobs):

  • cmake --build runtime/build -j 8 --target d3d12_pipeline_library_host_test (merged and main also gta6rt), then ctest -R "^d3d12_pipeline_library_host$" --output-on-failure
  • Stripped environment: ctest started with an empty environment plus only SystemRoot, TEMP and TMP, PATH=C:\Windows (System32 not on PATH), no COMSPEC.

Results:

  • RED (old test file from origin/main at the PR head, stripped environment): ctest "Exit code 0xc0000409", 0.93 s (the process fast-fails at the first host step, as the PR describes). Same old file in a normal environment: Passed (59 s), so the old test only breaks without a shell. Kind: environment-triggered, not a build failure.
  • GREEN at PR head, normal environment: Passed (24.6 s); the exe prints "72 steps compared with the host (22 more not compared), 0 mismatches".
  • GREEN at PR head, stripped environment: Passed (33.4 s), exit 0.
  • GREEN merged into origin/main: Passed (18.6 s) in a normal environment and in the stripped one.
  • Imports: dumpbin /imports gta6rt.exe, main vs main + PR: 701 DLL!symbol entries in both, 0 new, 0 removed (the PR does not touch anything linked into gta6rt).
  • Not tested: the kNoChild failure paths (CreatePipe/CreateProcess/ReadFile failing); the PR text says the author forced one by renaming the exe mid-run, I did not repeat it.

Machine: Windows 11 Pro x64, RTX 3090 24 GB, NVIDIA 621.40, MSVC 14.44.

RUN report for #1466 (test: spawn pipeline library host steps without a command shell) Kind: runtime C++, test only (`runtime/test/d3d12_pipeline_library_host_test.cpp`); no non-test change exists to revert, so the red is the old test file against the same trigger. Heads: PR head `cf728055f`, based on `db1a22d29`; origin/main `c22a0a732` (merged locally with `git merge --no-edit --no-ff`, clean, 1 file). Commands (VS 2022 Build Tools env from vcvars64, VS cmake + ninja, `-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, SDL3 static via SDL3_DIR, 8 jobs): - `cmake --build runtime/build -j 8 --target d3d12_pipeline_library_host_test` (merged and main also `gta6rt`), then `ctest -R "^d3d12_pipeline_library_host$" --output-on-failure` - Stripped environment: ctest started with an empty environment plus only SystemRoot, TEMP and TMP, PATH=C:\Windows (System32 not on PATH), no COMSPEC. Results: - RED (old test file from origin/main at the PR head, stripped environment): ctest "Exit code 0xc0000409", 0.93 s (the process fast-fails at the first host step, as the PR describes). Same old file in a normal environment: Passed (59 s), so the old test only breaks without a shell. Kind: environment-triggered, not a build failure. - GREEN at PR head, normal environment: Passed (24.6 s); the exe prints "72 steps compared with the host (22 more not compared), 0 mismatches". - GREEN at PR head, stripped environment: Passed (33.4 s), exit 0. - GREEN merged into origin/main: Passed (18.6 s) in a normal environment and in the stripped one. - Imports: `dumpbin /imports gta6rt.exe`, main vs main + PR: 701 DLL!symbol entries in both, 0 new, 0 removed (the PR does not touch anything linked into `gta6rt`). - Not tested: the `kNoChild` failure paths (CreatePipe/CreateProcess/ReadFile failing); the PR text says the author forced one by renaming the exe mid-run, I did not repeat it. Machine: Windows 11 Pro x64, RTX 3090 24 GB, NVIDIA 621.40, MSVC 14.44.
whoalin1 commented 2026-11-30 22:32:21 +00:00

Rebased onto current main as 95c3bba08 to refresh the stale CI baseline; the single-commit branch reapplied cleanly with no conflicts. Validation: CMake configure/generate passes and git diff --check is clean. The Windows crash/stripped-environment behavior remains covered by the prior independent validation rather than locally rerun.

Rebased onto current `main` as `95c3bba08` to refresh the stale CI baseline; the single-commit branch reapplied cleanly with no conflicts. Validation: CMake configure/generate passes and `git diff --check` is clean. The Windows crash/stripped-environment behavior remains covered by the prior independent validation rather than locally rerun.
aslan2142 commented 2026-12-01 16:36:09 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.