Skip to content

Fix driver.wait hang#831

Merged
vgvoleg merged 3 commits into
ydb-platform:mainfrom
UgnineSirdis:fix-wait-driver-hang
Jun 4, 2026
Merged

Fix driver.wait hang#831
vgvoleg merged 3 commits into
ydb-platform:mainfrom
UgnineSirdis:fix-wait-driver-hang

Conversation

@UgnineSirdis
Copy link
Copy Markdown
Contributor

@UgnineSirdis UgnineSirdis commented Jun 4, 2026

Retry reestablishing connection during driver start

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread ydb/pool.py
@UgnineSirdis UgnineSirdis force-pushed the fix-wait-driver-hang branch from 95a5258 to 32bf67d Compare June 4, 2026 14:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread ydb/pool.py Outdated
Comment thread tests/test_disable_discovery.py
@vgvoleg vgvoleg merged commit 598cac7 into ydb-platform:main Jun 4, 2026
35 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

🌋 SLO Test Results

🟢 2 workload(s) tested — All thresholds passed

Commit: da25edd · View run

Workload Thresholds Duration Report
sync-query 🟢 OK 10m 11s 📄 Report
sync-table 🟢 OK 10m 3s 📄 Report

Generated by ydb-slo-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants