Repository navigation
fix(cloudfetch): bound persistent download failures - #206
Conversation
Release the chunk-map guard before refreshing expired links, and count stale-link failures against the provider attempt budget so persistent failures surface instead of hanging. Refs databricks/databricks-odbc#144 Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — the fix is correct and well-tested. Releasing the DashMap guard via .clone() before refresh (line 612) and cloning cached_url (759-762) both avoid holding a guard across an await, and charging every download failure against the budget (729-731) correctly bounds persistent failures to exactly max_retries attempts (validated by the new wiremock test). One low-severity note inline about a last-attempt behavioral subtlety worth confirming.
| // Every completed download failure consumes the hard attempt | ||
| // budget, even when its link became stale while in flight. | ||
| attempts += 1; | ||
| if attempts >= ctx.max_retries { |
There was a problem hiding this comment.
🔵 Low — Moving the budget check ahead of the stale-recovery continue also changes behavior for the transient concurrent-refresh case, not just persistent failures. On the final allowed attempt (attempts >= ctx.max_retries), a download whose link was legitimately refreshed by a sibling task (was_refreshed_concurrently) now returns Err(e) immediately instead of getting one retry against the fresh URL. Previously that path would continue and retry with the updated link. With a small max_retries (e.g. 2) and short-lived presigned links relative to download time, a healthy server could surface a terminal error even though a fresh URL was already available in the cache.
This appears to be an intentional consequence of "charge every completed download failure," and is arguably the correct bound — flagging only to confirm the last-attempt stale-recovery drop is deliberate rather than an unintended side effect of the reorder.
Summary
Fix persistent CloudFetch download failures that can leave consumers blocked indefinitely.
When a request fails after its presigned URL crosses the expiry safety boundary, the provider previously skipped attempt accounting and retried with a refreshed URL. The expired-link path also retained a
DashMapread guard while the refresh routine accessed the same map, which can deadlock the awaited chunk while sibling tasks continue logging retries.This change releases the map guard before refresh and charges every completed download failure against the provider attempt budget. Transient stale-link recovery still refreshes immediately without an extra delay, but persistent failures now become terminal.
Tracks https://github.com/databricks/databricks-odbc/issues/144.
Test plan
cargo +stable fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test: 717 passed, including doc testsRelated-pattern audit
Reviewed every production
DashMapaccess and retry-budget bypass in the CloudFetch provider. No additional guards cross an await, and no other download failure path bypasses the hard attempt budget.