Repository navigation
fix(cloudfetch): bound chunk download with a per-chunk timeout (default 5m) (PECOBLR-4177) - #264
eric-wang-1990 wants to merge 4 commits into
Conversation
…lt 5m) A stalled cloud-storage response wedged `response.bytes()` in the CloudFetch chunk downloader indefinitely — reqwest's client-level timeout only covers the header phase (execute()), not the separately-awaited body read. The reyden nightly (kernel variant) hung ~52 min on a fault-injected CloudFetch stall until the 60-min CI job cap killed it, producing no error and no junit. Wrap the HTTP GET + body read in tokio::time::timeout with a per-chunk deadline (CloudFetchConfig::download_timeout, default 5 min via DEFAULT_DOWNLOAD_TIMEOUT_SECS). On expiry it returns a retriable Error::timeout() so the provider retry loop can react, instead of hanging. 5 min matches the ADBC C# driver's default download timeout; the Python (Thrift) driver uses a 60s between-bytes read timeout for the same purpose. This is a total per-attempt deadline (not idle-based) for now; a public config knob / idle-timeout refinement can follow. TDD: added a wiremock-backed test that a stalled response fails within the configured timeout (RED: 10s hang -> GREEN: ~0.2s). 804 lib tests pass, clippy --all-targets clean. Co-authored-by: Isaac Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a minimal, well-scoped defensive fix. Bounding the GET + body read with tokio::time::timeout and returning a retriable Error::timeout() (retryable=true per kernel_error.rs:330, honored by the download_chunk_with_retry loop) is correct, the config threads through cleanly with a sensible 5-min default matching ADBC C#, and the change carries a regression test. One low-severity note on test fidelity below.
54a58cc to
5d8fe6b
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a correct, well-scoped fix. Wrapping the GET + body read in tokio::time::timeout closes a real hang (reqwest's client timeout doesn't cover a separately-awaited response.bytes()), and I verified the three load-bearing claims: Error::timeout() is retriable (kernel_error.rs:330), the download retry loop retries on it (streaming_provider.rs:770-775), and download_timeout flows through via ..Default::default() (session.rs:1045) → reader/mod.rs:466. One low note on the regression test's fidelity to the body-read stall.
Addresses: - #3807480172 at src/reader/cloudfetch/chunk_downloader.rs:273 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a focused, correctly-tested CloudFetch download-timeout fix with no correctness concerns. Error::timeout() is retryable, the provider retry loop reacts to the returned error, the config threads through ..Default::default(), and tokio::time::timeout cancels the in-flight body read on expiry. One low note on the effective per-chunk bound interacting with the retry count.
Addresses: - #3808745445 at src/reader/cloudfetch/chunk_downloader.rs:118 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
|
https://docs.rs/reqwest/0.12.28/reqwest/struct.ClientBuilder.html#method.timeout Am I missing anything? |
|
This PR has been marked as Stale because it has been open for 30 days with no activity. If you would like the PR to remain open, please remove the stale label or comment on the PR. |
|
This PR was closed because it has been inactive for 7 days since being marked as stale. |
What
Bound each CloudFetch chunk download (HTTP GET + body read) with a per-chunk deadline so a stalled cloud-storage response fails with a retriable timeout instead of hanging the result stream.
Why
The
databricks-driver-testnightlyNightly Tests (Python · kernel · reyden)(run 32095064542) hung ~52 min with no output and was killed by the job'stimeout-minutes: 60— producing no error and no junit. The mitmproxy log shows it was not a connection hang: the session and query completed, then the harness'scloudfetch_timeoutfault-injection scenario stalled a blobGETand the download never returned.Root cause:
ChunkDownloader::download()awaitsresponse.bytes()with no bound. reqwest's client-level.timeout()only covers the header phase (execute()), not a separately-awaited body read — so a wedged blob read blocks indefinitely. The consumer's chunk-ready wait loop (streaming_provider.rs) treats its 30s timeout as "log and continue," so it can't rescue a stuck download either, andpytest-timeout(thread-based) can't interrupt the native call. Nothing below the 60-min CI cap ended it.How
CloudFetchConfig::download_timeout: Duration, default 5 minutes (DEFAULT_DOWNLOAD_TIMEOUT_SECS = 300), flowing throughresult_to_cloudfetch_configvia..Default::default().ChunkDownloadertakes it and wraps the GET +response.bytes()intokio::time::timeout(download_timeout, …), returning a retriableError::timeout()on expiry so the provider retry loop can react rather than hang.Cross-driver parity
SO_TIMEOUT)CancelAfter)5 min matches the ADBC C# default. This is a total per-attempt deadline (not idle-based) for now; a public config knob and/or an idle-timeout refinement can follow. Note the shared Rust CloudFetch code in
adbc-drivers/databrickshas the same gap and would benefit from the same fix.Testing (TDD)
download_times_out_when_response_stalls(wiremock: response delayed 10s, downloader timeout 200ms). RED: 10.0s hang → GREEN: ~0.2s, errors with a timeout message.cargo test --lib: 804 passed.cargo clippy --all-targetsclean.cargo fmtclean.cargo check --workspaceclean.Jira
Fixes PECOBLR-4177. Parent umbrella: PECOBLR-3727 (databricks-sql-kernel Reyden Support).
This pull request and its description were written by Isaac.