BUG: Reduce flaky Windows subprocess test timeouts #30884
Closed
+0
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows (Python 3.11–3.13), tests that spawn subprocesses occasionally time out in CI. The failures are inconsistent, affect different tests across runs, and usually indicate that a subprocess stalled during startup rather than that the test logic itself is broken.
What problem does it solve?
It lowers the frequency of spurious CI failures caused by:
backend auto-detection happening inside subprocesses,
contention around the shared font cache on Windows,
slower and less predictable subprocess startup compared to other platforms.
These issues currently cause otherwise valid PRs to fail CI.
Reasoning for this implementation
The change is applied in subprocess_run_helper, which is the common entry point for the affected tests. Inside the subprocess, the backend is set defensively to avoid auto-detection delays, the font cache is isolated to a temporary directory to prevent cross-process interference, and the timeout is relaxed on Windows only. A small amount of stderr logging is added to help diagnose any remaining stalls.
Linux and macOS behavior is unchanged.
Happy to add more details if needed !
PR checklist