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

Closed
ambroseautomation wants to merge 2 commits from upstream-pr/1338 into main
ambroseautomation commented 2026-11-24 22:00:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ambroseautomation on 2026-11-24T22:00:36Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481049293 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1338). Originally posted by [ambroseautomation](https://github.com/ambroseautomation) on 2026-11-24T22:00:36Z. --- ## 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T15:00:41Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166161765 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1338#issuecomment-7166161765). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-25T15:00:41Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-25T17:13:37Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169192828 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1338#issuecomment-7169192828). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-25T17:13:37Z. --- 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 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T18:47:54Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7200862600 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1338#issuecomment-7200862600). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T18:47:54Z. --- 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).

Pull request closed

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
ProjectLeonida/mandy!1338
No description provided.