Repository navigation
Fix repeated asyncio driver stop after discovery cancellation - #953
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #953 +/- ##
==========================================
+ Coverage 84.81% 84.85% +0.04%
==========================================
Files 102 102
Lines 14262 14267 +5
Branches 1508 1509 +1
==========================================
+ Hits 12096 12106 +10
+ Misses 1723 1717 -6
- Partials 443 444 +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.
🟡 Changes recommended
Two critical active issues remain: the regression test patches the production call with an incompatible signature, and concurrent stop() calls can propagate CancelledError instead of completing idempotently.
2 open issues
What changed in this PR
Makes asynchronous driver shutdown idempotent after discovery cancellation.
Changes:
- Adds an early return for already-stopped connection pools.
- Adds regression coverage for repeated shutdown.
- Documents the fix in the changelog.
| File | Description |
|---|---|
| ydb/aio/pool.py | Adds a guard to prevent repeated shutdown from awaiting a cancelled discovery task. |
| tests/aio/test_connection_pool.py | Adds regression coverage for stopping the driver twice after discovery cancellation. |
| CHANGELOG.md | Documents the asynchronous shutdown fix. |
Review effort: Lite
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 shutdown times out waiting for endpoint discovery, the asyncio driver cancels the discovery task. A repeated or concurrent
stop()can then await the cancelled task and raiseCancelledError.Serialize shutdown at the driver boundary so concurrent callers wait for cleanup to finish. Once the driver has stopped, subsequent calls return immediately.