Repository navigation
Fix async session pool slot leak on keep-alive failure - #934
Merged
vgvoleg merged 5 commits intoNov 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #934 +/- ##
==========================================
+ Coverage 82.64% 82.69% +0.04%
==========================================
Files 99 99
Lines 12950 12950
Branches 1266 1266
==========================================
+ Hits 10703 10709 +6
+ Misses 1796 1789 -7
- Partials 451 452 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the change includes targeted regression coverage for failed or cancelled keep-alive operations and pool-slot reuse.
No open issues 🎉
What changed in this PR
Fixes an async SessionPool slot leak when an idle session’s keep-alive operation fails or is cancelled. Failed sessions are now cleaned up so their pool capacity can be reused.
Changes:
- Move the keep-alive operation into the existing cleanup path.
- Add regression coverage for
BadSession,ConnectionLost, andCancelledError. - Document the fix in the changelog.
| File | Description |
|---|---|
ydb/aio/table.py |
Cleans up sessions after failed or cancelled keep-alive operations and releases pool capacity. |
tests/aio/test_session_pool.py |
Adds regression tests verifying session deletion, slot release, and replacement-session acquisition. |
CHANGELOG.md |
Documents the async session-pool capacity leak fix. |
Review effort: Lite
eblackbu
marked this pull request as ready for review
November 2, 2026 09:34
vgvoleg
approved these changes
Nov 2, 2026
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.
When KeepAlive fails for an idle session,
SessionPool._send_keep_alive()exits before its cleanup handler, leaving the pool slot occupied. Move the KeepAlive await inside the existing cleanup block so the session is destroyed and its slot is released.Three pytest regression cases cover
BadSession,ConnectionLost, andCancelledError. They verify session deletion, released pool capacity, and acquisition of a replacement sessionValidation: