ERROR:databricks.sql.common.unified_http_client:HTTP request error: Retry request would exceed Retry policy max retry duration of 300 seconds (#709)#878
Open
peco-engineer-bot[bot] wants to merge 1 commit into
Conversation
…etry request would exceed Retry policy max retry duration of 300 seconds (#709) Signed-off-by: peco-engineer-bot[bot] <3815206+peco-engineer-bot[bot]@users.noreply.github.com>
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.
Summary
Automated fix for #709 — ERROR:databricks.sql.common.unified_http_client:HTTP request error: Retry request would exceed Retry policy max retry duration of 300 seconds.
Aligned ClientContext's retry defaults in src/databricks/sql/auth/common.py with the connector-wide defaults (30 attempts / 900.0s) used by the Thrift and SEA backends, which are anchored to the ODBC/JDBC drivers; the previous 5/300.0 fallback cut CloudFetch downloads (which build their DatabricksRetryPolicy from ClientContext via UnifiedHttpClient) off at exactly the 300s ceiling the reporter hit. This is an offline-only client-side retry-config artifact anchored to the reference driver defaults, so a unit test (not e2e) is appropriate — a live warehouse cannot deterministically be made to time out a cloudfetch download to observe the change.
Root cause & plan
Root cause: CloudFetch result downloads (ResultSetDownloadHandler.run -> UnifiedHttpClient.request_context) build their DatabricksRetryPolicy from ClientContext, whose retry defaults diverge from every other backend. In src/databricks/sql/auth/common.py (lines 76-81) ClientContext falls back to retry_stop_after_attempts_count=5 and retry_stop_after_attempts_duration=300.0, whereas the Thrift backend (thrift_backend.py:85-86) and the SEA http client (sea/utils/http_client.py:88-91) both default these to 30 and 900.0. Because build_client_context (utils.py:996) only fills these from the user's retry* kwargs, an unset value hits the 300s/5-attempt fallback for all UnifiedHttpClient traffic — including cloudfetch downloads. So when a cloudfetch download is slow/flaky, retries are cut off at the ClientContext-only 300s ceiling and the connector raises 'Retry request would exceed Retry policy max retry duration of 300 seconds' (exactly the number the reporter saw), giving up much sooner than the documented 900s the rest of the connector uses. Fix: align ClientContext's retry_stop_after_attempts_count / retry_stop_after_attempts_duration defaults with the connector-wide documented defaults (30 / 900.0).
Files:
src/databricks/sql/auth/common.pyPlanned coverage:
Files changed
tests/unit/test_client_context_retry_defaults.pysrc/databricks/sql/auth/common.pyTest plan
tests/unit/test_client_context_retry_defaults.py::TestClientContextRetryDefaults::test_default_max_retry_duration_is_900— fails (red) against the original code, passes (green) after the fixtests/unit/test_client_context_retry_defaults.py::TestClientContextRetryDefaults::test_default_max_retry_count_is_30— fails (red) against the original code, passes (green) after the fixtests/unit/test_client_context_retry_defaults.py::TestClientContextRetryDefaults::test_user_override_still_honored— fails (red) against the original code, passes (green) after the fix🤖 Generated by engineer-bot (bug-fix flow) — review before merge.