Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Retry the NVIDIA probe control case past the Linux pwsh redirect race (#12477)

Daniel Han23f9016bf34b
diff --git a/tests/python/test_windows_installer_resolver_fallback.py b/tests/python/test_windows_installer_resolver_fallback.py
index 3ca560c0291..8bc713e4176 100644
--- a/tests/python/test_windows_installer_resolver_fallback.py
+++ b/tests/python/test_windows_installer_resolver_fallback.py
@@ -1952,31 +1952,44 @@ def test_a_hung_integrity_tool_cannot_stall_the_nvidia_probe(tmp_path: Path, sou
TMP = str(tmp_path),
TMPDIR = str(tmp_path),
)
- started = time.monotonic()
- result = run_pwsh(
- [
- "pwsh",
- "-NoProfile",
- "-File",
- str(script),
- str(REPO_ROOT / source),
- str(python),
- # The hung cases time only the integrity utilities, which carry their own deadlines,
- # so the child keeps a 1 s budget there. The control asserts the child's answer
- # arrives; 1 s for a pwsh-launched child is not enough on a loaded xdist runner,
- # where it came back empty once (#12447's run), so it gets a budget that only a
- # genuinely hung child would exhaust.
- "1000" if hung else "10000",
- ],
- env = env,
- capture_output = True,
- text = True,
- timeout = 30,
- )
- assert result.returncode == 0, result.stderr
- assert time.monotonic() - started < 20, "a hung integrity utility outlived its deadline"
+
+ def attempt():
+ started = time.monotonic()
+ result = run_pwsh(
+ [
+ "pwsh",
+ "-NoProfile",
+ "-File",
+ str(script),
+ str(REPO_ROOT / source),
+ str(python),
+ # The hung cases time only the integrity utilities, which carry their own deadlines,
+ # so the child keeps a 1 s budget there. The control asserts the child's answer
+ # arrives, so it gets a budget that only a genuinely hung child would exhaust.
+ "1000" if hung else "10000",
+ ],
+ env = env,
+ capture_output = True,
+ text = True,
+ timeout = 30,
+ )
+ assert result.returncode == 0, result.stderr
+ assert time.monotonic() - started < 20, "a hung integrity utility outlived its deadline"
+ return result
+
+ result = attempt()
if hung is None:
# Control: a healthy host still gets the Python answer, so the case above is not vacuous.
+ # On Linux, pwsh's Start-Process copies a redirected stdout into the file from an async
+ # handler, so Wait-Process can return before the child's line lands and the probe reads
+ # an empty file (about 1 in 100 runs under xdist load, as in #12471's run). Windows hands
+ # the child the file handle itself, so this race is the parity host's, not the installer's.
+ # A probe that really lost its answer comes back empty every time and still fails here.
+ for _ in range(2):
+ # Only the race's exact signature is retried; a wrong or duplicated answer fails at once.
+ if _lines(result, "ANSWER:") != ["ANSWER:"]:
+ break
+ result = attempt()
assert _lines(result, "ANSWER:") == ["ANSWER:nvml;12;8;8.9"], result.stdout