Repository navigation
gh-145638: Slai Agent Runtime: add atomic signal wakeup updates - #159035
Closed
huong8373tt-beep wants to merge 1 commit into
Closed
huong8373tt-beep wants to merge 1 commit into
huong8373tt-beep wants to merge 1 commit into
Conversation
huong8373tt-beep
requested review from
1st1,
asvetlov,
kumaraditya303 and
willingc
as code owners
October 8, 2026 17:33
Documentation build overview
|
Member
|
Fully automated PRs are rejected and the issue is still under discussion. Do not open PRs for such cases. |
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.
Summary
signal.get_wakeup()to read the complete process-wide wakeup configuration without modifying it.check_previous=tosignal.set_wakeup_fd()for conditional compare-and-set updates.BaseProactorEventLoop.close()clear the wakeup fd only when the loop still owns the configuration it installed.Fixes gh-145638.
Problem
signal.set_wakeup_fd()owns one process-global configuration, but it currently exposes only an unconditional setter. On Windows, a laterProactorEventLoopcan replace an earlier loop's wakeup socket. When the earlier loop closes or is finalized, its unconditionalset_wakeup_fd(-1)disables wakeups for the still-live loop.The same ownership conflict affects embedded/guest event loops and other cooperating hosts. Reading the current fd by setting it to
-1and restoring it creates a signal-loss window and does not preserve the complete configuration.Design
signal.get_wakeup()returns an immutablesignal.wakeupsnapshot withfd,warn_on_full_buffer, and Windowsis_socketstate.signal.set_wakeup_fd(..., check_previous=snapshot)updates only if the exact observed configuration is still current; otherwise it raisesRuntimeErrorwithout changing the process state.BaseProactorEventLoopstores the snapshot it installed. On close, it uses the conditional update, so an older loop cannot clear a wakeup configuration installed by a newer loop or host.Validation
x64 Debugon Windows: 0 warnings, 0 errors.python -m test -v test_signal test_asyncio.test_proactor_events test_asyncio.test_windows_events: passed (162 tests run; 40 platform skips).git diff --check: passed.Lib/test/ssltests.pybecause the previous warning-only attempt for asyncio.ProactorEventLoop mishandles signal wakeup file descriptor #87079 regressed SSL buildbots. Its directtest_sslfailure is baseline-equivalent on this host: Windows localizes WinError 10054 while the existing assertion accepts only English text. The affected asyncio SSL tests passed in the suite.Slai Agent Runtime context
Slai Agent Runtime encountered this class of failure while operating in a Windows automation environment where multiple runtime components can create and dispose event loops in one process. The developer authorized this contribution after local reproduction and validation. This PR contains only CPython public-source changes, generated CPython artifacts, documentation, and CPython-owned tests.