Repository navigation
gh-81207: Handle socketserver timeouts at the deadline - #159628
Open
LarryHu0217 wants to merge 1 commit into
Open
LarryHu0217 wants to merge 1 commit into
LarryHu0217 wants to merge 1 commit into
Conversation
Treat an empty selector result at the deadline as a timeout instead of polling again with zero remaining time. Cover exact and elapsed deadlines, early wakeups, and ready requests with deterministic clock and selector tests.
Member
|
We can't review until you sign the CLA. |
picnixz
marked this pull request as ready for review
October 17, 2026 20:55
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.
Fixes #81207.
After an empty selector result,
BaseServer.handle_request()now treats a remaining timeout of zero as expired. This prevents repeated zero-timeout polls when the clock stays exactly at the deadline. Retries before the deadline and ready requests with a zero timeout keep their existing behavior.Adds deterministic clock/selector regression tests for zero, exact, early-wakeup and elapsed deadlines, a ready-request control, and a Library NEWS entry.
Validated on macOS arm64 using the existing
--with-pydebugconfiguration ate5ef47e94f7c9d970ad98e2c33870ccc3b04dc5c:make -j2./python.exe -B -m test -u network test_socketserver: 30 tests, success../python.exe -B -m test -v -u network,cpu,walltime test_selectors test_httpservers test_xmlrpc: 318 tests, 50 standard platform/FD-limit skips, no failures../python.exe -B -m test -u network -R 3:3 -m 'test_handle_request*' test_socketserver: pass.Tools/patchcheck/patchcheck.py, scopedruff check --no-fix --no-cache(0.15.22), andgit diff --check: pass.The entire CPython test suite was not run locally.