Repository navigation
Close native update coroutines cancelled while waiting for processor capacity - #5391
Open
realchrisbarnes wants to merge 1 commit into
Open
realchrisbarnes wants to merge 1 commit into
realchrisbarnes wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Close native update coroutines cancelled while waiting for processor capacity
When
BaseUpdateProcessor.process_updateis cancelled while waiting for its concurrency semaphore, the supplied native coroutine never reachesdo_process_updateand remains unclosed. Close it during cleanup if admission has not occurred. Once admitted, the subclass retains ownership; Futures and arbitrary awaitables are left untouched.Adds native processor regressions for the queued native coroutine, untouched Future/custom awaitable (including a
closemethod), slot recovery, and admitted subclass ownership. The regression fails on master withCORO_CREATEDinstead ofCORO_CLOSEDand passes with this change.Related: #5390
Validation on master
9a38d8f516fd14c56ef51dc21817d8fbe44c267c, Python 3.14.9, locked upstream test/lint dependencies:python -B -m pytest --disable-socket tests/ext/test_baseupdateprocessor.py: 13 passed (before the source change: 1 failed, 12 passed).ruff check src/telegram/ext/_baseupdateprocessor.py tests/ext/test_baseupdateprocessor.py: passed.ruff format --check src/telegram/ext/_baseupdateprocessor.py tests/ext/test_baseupdateprocessor.py: passed.These are offline processor tests; no Bot, transport or account is constructed. The complete repository suite and other Python versions were not run. Cancellation before
process_updatestarts executing remains the caller's responsibility.