check_d3d12_trace: capture fixture output in files so a timeout cannot wait for its children (OLD-9920) #1338

Closed
leonida/mandy
ambroseautomation wants to merge 0 commits from carry/old-9920-check-d3d12-trace-timeout into main

Pull request closed

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

ambroseautomation commented 2026-11-24 22:00:36 +00:00

Summary

Coordination item: OLD-9920 (carry-forward of old-pr/9920, preserving original author Sunkiller-qc across both commits).

Problem & Root Cause

In runtime/test/check_d3d12_trace.py, when a timed-out fixture was killed, calling communicate() on piped stdout/stderr could block indefinitely if a grandchild process inherited and kept the pipe handles open.

Implementation

  • Captures the fixture's stdout/stderr in temporary files rather than pipes in runtime/test/check_d3d12_trace.py and finishes waiting/cleanup after killing a timed-out fixture so grandchildren holding descriptors cannot block the runner.
  • Adds test_runner_timeout_does_not_wait_for_a_child_holding_the_output in tests/test_check_d3d12_trace.py.

Tests Run

Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data).

  • python -I -m py_compile runtime/test/check_d3d12_trace.py tests/test_check_d3d12_trace.py — PASS
  • pytest tests/test_check_d3d12_trace.py -v — 3 passed, 1 skipped (POSIX-only os.kill(pid, 0) check skipped on Windows; new test_runner_timeout_does_not_wait_for_a_child_holding_the_output PASSED)
  • python -I scripts/check_no_game_data.py runtime/test/check_d3d12_trace.py tests/test_check_d3d12_trace.py — PASS

Disclosure

AI-assisted: yes (carry-forward, rebase onto current main, and local verification; original implementation by Sunkiller-qc).

## Summary Coordination item: `OLD-9920` (carry-forward of `old-pr/9920`, preserving original author `Sunkiller-qc` across both commits). ### Problem & Root Cause In `runtime/test/check_d3d12_trace.py`, when a timed-out fixture was killed, calling `communicate()` on piped stdout/stderr could block indefinitely if a grandchild process inherited and kept the pipe handles open. ### Implementation - Captures the fixture's stdout/stderr in temporary files rather than pipes in `runtime/test/check_d3d12_trace.py` and finishes waiting/cleanup after killing a timed-out fixture so grandchildren holding descriptors cannot block the runner. - Adds `test_runner_timeout_does_not_wait_for_a_child_holding_the_output` in `tests/test_check_d3d12_trace.py`. ## Tests Run Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data). - `python -I -m py_compile runtime/test/check_d3d12_trace.py tests/test_check_d3d12_trace.py` — PASS - `pytest tests/test_check_d3d12_trace.py -v` — 3 passed, 1 skipped (POSIX-only `os.kill(pid, 0)` check skipped on Windows; new `test_runner_timeout_does_not_wait_for_a_child_holding_the_output` PASSED) - `python -I scripts/check_no_game_data.py runtime/test/check_d3d12_trace.py tests/test_check_d3d12_trace.py` — PASS ## Disclosure AI-assisted: yes (carry-forward, rebase onto current `main`, and local verification; original implementation by Sunkiller-qc).
PierreEbele commented 2026-11-25 15:00:41 +00:00

Reviewed 865d357: ran python3 -I tests/test_check_d3d12_trace.py on the PR tree on Linux (4/4 pass) and on main with your test file copied in (4/4 pass too — on POSIX killpg kills the pipe-holding child, so the new test only discriminates on Windows). A probe with a runner that exits at ~1 s while a 30 s child inherits its output shows the fix matters on Linux as well: main fails fixture.exe: no exit within 5s at the deadline; this PR returns at ~1.1 s. Minor: read_output() maps CRLF→LF only, so a lone \r that the old pipes turned into \n now reaches the failure message raw (repro: sys.stderr.write('fixture output\r'); sys.exit(3)) — outcomes unchanged since splitlines() still splits on \r; at most a docstring tweak. The Windows hang and the coordination-item claim I could not verify here (no Windows, no GitHub access). AI-assisted review.

Recommendation: Merge

Reviewed 865d357: ran `python3 -I tests/test_check_d3d12_trace.py` on the PR tree on Linux (4/4 pass) and on main with your test file copied in (4/4 pass too — on POSIX killpg kills the pipe-holding child, so the new test only discriminates on Windows). A probe with a runner that exits at ~1 s while a 30 s child inherits its output shows the fix matters on Linux as well: main fails `fixture.exe: no exit within 5s` at the deadline; this PR returns at ~1.1 s. Minor: `read_output()` maps CRLF→LF only, so a lone `\r` that the old pipes turned into `\n` now reaches the failure message raw (repro: `sys.stderr.write('fixture output\r'); sys.exit(3)`) — outcomes unchanged since `splitlines()` still splits on `\r`; at most a docstring tweak. The Windows hang and the coordination-item claim I could not verify here (no Windows, no GitHub access). AI-assisted review. **Recommendation:** Merge
MoonEyes commented 2026-11-25 17:13:37 +00:00

Thanks for this. Its diff is identical to #1330 (same two commits, opened ~2 minutes earlier), so it seems to be a duplicate; leaving it to the maintainers to decide which one to keep.

AI-assisted: yes (Claude Code compared the diffs against origin/main; I reviewed it).

Thanks for this. Its diff is identical to #1330 (same two commits, opened ~2 minutes earlier), so it seems to be a duplicate; leaving it to the maintainers to decide which one to keep. AI-assisted: yes (Claude Code compared the diffs against origin/main; I reviewed it).
wavehs commented 2026-11-26 18:47:54 +00:00

This is the same change as #1330 (fin-github, opened 2026-11-24 21:58, two minutes earlier): the two diffs are byte-identical (only blob hashes differ), same two files, both claim OLD-9920, and both preserve the original author. I applied #1330 to main f107ae044: clean apply and python3 -I tests/test_check_d3d12_trace.py is OK.

One of the two is redundant. #1330 is the earlier one and says it is the git cherry-pick -x of draft #188; I would keep that and close this, unless you two agree on the other order. No content difference either way.

AI-assisted (review/verification only).

This is the same change as **#1330** (fin-github, opened 2026-11-24 21:58, two minutes earlier): the two diffs are byte-identical (only blob hashes differ), same two files, both claim OLD-9920, and both preserve the original author. I applied #1330 to `main` `f107ae044`: clean apply and `python3 -I tests/test_check_d3d12_trace.py` is `OK`. One of the two is redundant. #1330 is the earlier one and says it is the `git cherry-pick -x` of draft #188; I would keep that and close this, unless you two agree on the other order. No content difference either way. AI-assisted (review/verification only).
Sign in to join this conversation.
No description provided.