check_d3d12_trace: finish communicate() after killing a timed-out fixture #188

Closed
github-bot wants to merge 2 commits from github-bot/gh-188 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:38 UTC · original
ubiquitarianism:old-pr/9920 → main · +54 −12 · 2 files · 2 commits · closed without merging

Carried over from old PR 9920 by Sunkiller-qc in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9920, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
Sunkiller-qc: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Thanks for 433edaa. The subprocess docs recommend finishing with communicate() after killing a timed-out child so the pipes are drained. The call has a limit so a stray process holding the pipes can't stretch the timeout.

Not run on my side; tests/test_check_d3d12_trace.py should cover it.

**@⁠Andretuta** on GitHub · 2026-11-24 02:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/188) `ubiquitarianism:old-pr/9920` → `main` · +54 −12 · 2 files · 2 commits · closed without merging > Carried over from **old PR 9920** by `Sunkiller-qc` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9920`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `Sunkiller-qc`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Thanks for 433edaa. The subprocess docs recommend finishing with communicate() after killing a timed-out child so the pipes are drained. The call has a limit so a stray process holding the pipes can't stretch the timeout. Not run on my side; `tests/test_check_d3d12_trace.py` should cover it.
Follow-up to 433edaa. After a timeout the run called process.wait(), which
reaps the process but leaves the output pipes undrained. As the subprocess
documentation advises, finish with communicate() once the process is killed.
The call is bounded so a stray process that still holds the pipes (a runner
without its own process group) cannot hold the check past its limit.
Review of #9920 (thanks, Gevroska): on Windows a grandchild that inherits the
launcher's stdout/stderr pipes kept the check waiting past RUNNER_TIMEOUT,
on main and with the bounded communicate(), because leaving the Popen
context manager joins the pipe reader threads, which wait for every holder
of the pipes.

run_fixture no longer uses pipes: the output goes to two temporary files and
the run waits for the launcher alone, so no read can wait for a child. On a
timeout kill_tree() stops the process group on POSIX (as before) or the
process tree with taskkill /F /T on Windows, then the launcher is killed and
reaped with a bound. The files are read back as the pipes gave the text
(UTF-8 with replacements, \n line ends).

tests/test_check_d3d12_trace.py gains the reviewer's case: a launcher whose
child inherits its output and sleeps 30 s while the launcher sleeps 60 s,
with a 2 s limit; the check must fail with the one-line message within 15 s.
Not run here.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:48:04 +00:00
Author
Owner

@⁠sodove on GitHub · 2026-11-24 06:30 UTC · original

I compared current main at 8f481cf16f and this PR at cc2e281959 on native Windows 11 build 26100 with Python 3.12.10. I ran two direct fixtures without a runner, with a two-second timeout. In both cases the descendant inherited stdout and stderr. I opened a Windows process handle before letting the fixture proceed so I could check whether the descendant was still running.

Fixture Current main PR head
Fixture and descendant both keep running Timeout after 7.11 s, descendant still running at return Timeout after 2.16 s, descendant verified exited
Fixture exits zero with one synthetic trace entry while descendant holds output open False timeout after 7.08 s Trace returned in 0.06 s while the descendant was still running

The synthetic descendant had a seven-second fallback and a release signal for cleanup. The stock runner tests also passed on the PR head, with three passed and the POSIX-only process-group test skipped.

Synthetic processes only. AI-assisted verification.

**@⁠sodove** on GitHub · 2026-11-24 06:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/188#issuecomment-7124007528) I compared current main at 8f481cf16f261c7f37458aeb45e8f4e19994146d and this PR at cc2e28195926db2cfdc2ea9a3f3824f8282e7f54 on native Windows 11 build 26100 with Python 3.12.10. I ran two direct fixtures without a runner, with a two-second timeout. In both cases the descendant inherited stdout and stderr. I opened a Windows process handle before letting the fixture proceed so I could check whether the descendant was still running. | Fixture | Current main | PR head | | --- | --- | --- | | Fixture and descendant both keep running | Timeout after 7.11 s, descendant still running at return | Timeout after 2.16 s, descendant verified exited | | Fixture exits zero with one synthetic trace entry while descendant holds output open | False timeout after 7.08 s | Trace returned in 0.06 s while the descendant was still running | The synthetic descendant had a seven-second fallback and a release signal for cleanup. The stock runner tests also passed on the PR head, with three passed and the POSIX-only process-group test skipped. Synthetic processes only. AI-assisted verification.
Author
Owner

@⁠fin-github on GitHub · 2026-11-24 21:58 UTC · original

Taken over in #1330: the same commits cherry-picked onto current main with -x, original author kept, tests rerun there (they still fail on main without the change). The draft can be closed as #17 describes. AI-assisted (Claude Code).

**@⁠fin-github** on GitHub · 2026-11-24 21:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/188#issuecomment-7145633106) Taken over in #1330: the same commits cherry-picked onto current `main` with `-x`, original author kept, tests rerun there (they still fail on `main` without the change). The draft can be closed as #17 describes. AI-assisted (Claude Code).
github-bot closed this pull request 2026-11-27 04:04:18 +00:00
Author
Owner

@⁠Andretuta on GitHub · 2026-11-27 04:02 UTC · original

Closing carried-over draft: taken over in #1330 (OLD-9920).

**@⁠Andretuta** on GitHub · 2026-11-27 04:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/188#issuecomment-7209464760) Closing carried-over draft: taken over in #1330 (OLD-9920).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.