[PR #1466] test: spawn pipeline library host steps without a command shell #1495

Open
opened 2026-11-26 20:21:26 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1466
Author: @whoalin1
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: plh-crash-fix


📝 Commits (1)

  • cf72805 test: spawn pipeline library host steps without a command shell

📊 Changes

1 file changed (+87 additions, -9 deletions)

View changed files

📝 runtime/test/d3d12_pipeline_library_host_test.cpp (+87 -9)

📄 Description

Claimed in the coordination issue: https://github.com/ubiquitarianism/leonida/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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1466 **Author:** [@whoalin1](https://github.com/whoalin1) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `plh-crash-fix` --- ### 📝 Commits (1) - [`cf72805`](https://github.com/ubiquitarianism/leonida/commit/cf728055fca80de14ca4eb64959f8b28b2f1119a) test: spawn pipeline library host steps without a command shell ### 📊 Changes **1 file changed** (+87 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/d3d12_pipeline_library_host_test.cpp` (+87 -9) </details> ### 📄 Description Claimed in the coordination issue: https://github.com/ubiquitarianism/leonida/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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1495
No description provided.