Fix driver.wait hang#831
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets a startup reliability issue where (with discovery disabled) an initial connection failure could leave the driver waiting indefinitely for an endpoint that will never appear. It introduces retry/cleanup behavior (notably in the async driver path) and tightens connection teardown to avoid retaining stale channel/stub state.
Changes:
- Add retry loop for initial connection establishment when discovery is disabled in the async connection pool, with cancellation-safe cleanup.
- Ensure connection cache cleanup on
stop()when discovery is disabled (sync + async paths). - Make connection
destroy()clear cached stubs and null out the channel; add tests for cleanup and async retry behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
ydb/pool.py |
Ensure cached connections are cleaned up on stop when discovery is disabled (no discovery thread). |
ydb/connection.py |
Harden teardown by clearing stub cache and dropping the channel reference during destroy. |
ydb/aio/pool.py |
Retry initial connection when discovery is disabled; add stopping flag and ensure cleanup on stop/cancel. |
ydb/aio/connection.py |
Mirror sync destroy improvements (clear stubs, drop channel reference). |
tests/test_disable_discovery.py |
Add regression tests for sync stop cleanup and async initial connection retry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
95a5258 to
32bf67d
Compare
🌋 SLO Test Results🟢 2 workload(s) tested — All thresholds passed
Generated by ydb-slo-action |
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.
Retry reestablishing connection during driver start
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Fix driver.wait hang. If driver gets error during connection, it hangs waiting for connection, but the connection does not retry to reestablish. It reproduces in real tests.
Other information