Repository navigation
Conversation
Every event loop opens a socketpair for its self-pipe, and on Windows that is a loopback TCP connection that leaves a port in TIME_WAIT when closed. With a loop per test, a full run opens about 26,000 of them and can use up the dynamic port range. With one loop per session the suite opens about 100, so the Windows-only SO_LINGER fixture is no longer needed. No test leaves a task or timer on the shared loop, and shuffled runs fail the same tests as with a loop per test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stream) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Test finished: the change is now in python-kasa#1839. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Test PR on the fork only. Do not merge. It runs the real CI matrix on an alternative to the SO_LINGER fixture in python-kasa#1839.
The diff against
fix/windows-test-hang(python-kasa#1839's head,91d5b93):pyproject.toml: pytest-asyncio's fixture and test loop scopes aresession, so the run uses one event loop per worker instead of one per test. Each loop opens a socketpair for its self-pipe; on Windows that is a loopback TCP connection that leaves a port in TIME_WAIT. A full run drops from 26,364 pairs to 102.tests/conftest.py: the Windows-only SO_LINGER fixture is removed (back to master's file)..github/workflows/windows-probe.yml: fork-only probe. It runs on push toprobe/**and samples TIME_WAIT on Windows for 3.11–3.15 with-n auto, plus 3.14 and 3.15 with-n0.Checked locally on Linux: the full suite passes with
-n 4and serially. No test leaves a task or timer on the shared loop. A fixed shuffled order fails the same 24 order-dependent tests with either loop scope.🤖 Generated with Claude Code