Skip to content

fix(http): improve transient transport retries - #293

Merged
vuanhphung merged 4 commits into
mainfrom
fix/transport-retry-small-gaps
Aug 27, 2026
Merged

vuanhphung merged 4 commits into
mainfrom
fix/transport-retry-small-gaps

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Treat temporary DNS resolver failures as retryable while continuing to fail fast for permanent unknown-host responses. The existing five-retry/six-attempt default remains unchanged.

Add socket-level coverage for connection refusal, dropped connections, and per-request timeouts.

Relationship to ADBC transport-error retry (adbc-drivers/databricks#373)

ADBC #373 added transport-level retry to the C# driver. The kernel's reqwest-based retry loop already covered most of that surface, so the only behavioral change here is around DNS; the rest is test coverage confirming pre-existing behavior.

ADBC #373 adds (to C#) Kernel already had it? This PR
Retry connection-refused Yes — is_connect() Adds a test
Retry TCP reset / dropped connection Yes — is_connect() / is_request() Adds a test
Per-request timeout for dead/half-open TCP Yes — reqwest .timeout() fires per attempt → is_timeout() Adds a test
Exp. backoff + jitter budget for transport errors Yes — shared retry loop —
Retry all DNS failures, incl. permanent NXDOMAIN (no distinction) No — failed fast on all DNS errors Retry transient DNS only; still fail-fast on NXDOMAIN — narrower than ADBC, by design

Not matched, intentionally: no standalone transport-retry toggle; non-idempotent ExecuteStatement retries only is_connect() to avoid double-execution.

Tested with cargo +stable fmt --all, cargo clippy --all-targets -- -D warnings, and cargo test.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Looks good — a deliberate, correct refinement of transient-vs-permanent DNS classification with solid socket-level test coverage. The narrowed marker set still fails fast on NXDOMAIN across Linux/macOS/Windows system-resolver phrasings while letting temporary resolver failures follow the idempotency retry policy, matching the PR intent. One low, non-blocking note on test hang-vs-fail robustness.

Comment thread src/client/http.rs Resolved
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Looks good — the DNS reclassification is deliberate, correctly routed through is_connect()/is_request()/is_timeout(), and the three new socket-level tests (refused/dropped/timeout) exercise the intended paths. One low-severity edge: the narrowed permanent-DNS marker set is resolver-string-specific, so a permanent NXDOMAIN on a resolver with a non-matching message (e.g. musl) would now burn the retry budget instead of failing fast.

Comment thread src/client/retry.rs
if msg.contains("dns error")
|| msg.contains("failed to lookup address")
|| msg.contains("name or service not known")
if msg.contains("name or service not known")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Low — The narrowed marker set is tied to specific resolver phrasings — glibc Name or service not known, macOS nodename nor servname, Windows No such host, plus hickory-only nxdomain/non-existent domain. Because the generic fallbacks (dns error, failed to lookup address, name resolution) were removed, a permanent NXDOMAIN whose error string doesn't contain one of the retained phrases is now classified transient and retried until the full retry budget is exhausted — a regression from the previous fail-fast behavior for that host.

This is fine on glibc/macOS/Windows with the default getaddrinfo resolver, but musl (Alpine) returns a different EAI_NONAME string that matches none of the retained markers, so an NXDOMAIN there would consume all six attempts. If musl targets are in scope, consider keeping a permanent-only fallback (e.g. matching EAI_NONAME/not resolve phrasings) or add a musl-phrasing case to the marker list. Non-blocking — flagging the trade-off since the PR intentionally reclassifies DNS errors.

@vuanhphung
vuanhphung added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 6d3b765 Aug 27, 2026
20 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 46171fb3 Deployed Aug 26, 2026 by oss-reviewer-bot[bot] via followup #1049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants