Skip to content

apollo_starknet_client: add request and connect timeouts to the http client - #14966

Merged
matanl-starkware merged 1 commit into
mainfrom
matanl/starknet-client-request-timeout
Aug 19, 2026
Merged

apollo_starknet_client: add request and connect timeouts to the http client#14966
matanl-starkware merged 1 commit into
mainfrom
matanl/starknet-client-request-timeout

Conversation

@matanl-starkware

Copy link
Copy Markdown
Collaborator

Why

RCA of the Testnet node-3 "Consensus Height Diff From Sync" spike to ~335 on Aug 12 (00:24–00:33 UTC): a single get_block?blockNumber=latest request from central sync got wedged inside the GCLB front end for 612s (logged as 502 internal_error with no serverIp, 20× the backend's 30s timeoutSec). The reqwest client is built with no timeout at all, so the call hung until central sync's no-progress watchdog fired on its 5-minute granularity — a 9m17s sync stall (~335 blocks) from one dead request.

The retry layer already classifies reqwest timeout errors as retryable (RetryErrorCode::Timeout), but reqwest never produces one without a configured timeout, so it could never engage.

What

Add a 60s total request timeout and a 10s connect timeout to the shared StarknetClient reqwest client (feeder + gateway clients). A hung connection now surfaces as a retryable timeout and request_with_retry re-issues the request on a fresh connection, bounding the stall at seconds instead of ~10 minutes. 60s is far above feeder p99 even for multi-MB class-definition responses.

Verification

  • cargo build -p apollo_starknet_client — clean
  • SEED=0 cargo test -p apollo_starknet_client — 76 passed, 0 failed
  • cargo clippy -p apollo_starknet_client --all-targets --all-features — clean
  • scripts/rust_fmt.sh — clean

🤖 Generated with Claude Code

…client

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches all feeder/gateway HTTP traffic; legitimately slow responses could now time out and trigger retries, though 60s is intended to stay above normal p99 latency.

Overview
Configures the shared StarknetClient reqwest builder with a 60s overall request timeout and 10s connect timeout (new REQUEST_TIMEOUT / CONNECT_TIMEOUT constants), so hung feeder/gateway calls fail instead of blocking callers indefinitely.

That lets existing request_with_retry logic treat reqwest timeout errors as RetryErrorCode::Timeout and retry on a fresh connection, capping stalls to seconds rather than multi-minute sync watchdog delays.

Reviewed by Cursor Bugbot for commit fb04b25. Bugbot is set up for automated code reviews on this repo. Configure here.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@ron-starkware ron-starkware left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ron-starkware reviewed 1 file and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on matanl-starkware).

@matanl-starkware
matanl-starkware added this pull request to the merge queue Aug 19, 2026
Merged via the queue into main with commit 2ba0aa5 Aug 19, 2026
19 checks passed

Copy link
Copy Markdown
Contributor

Security scan complete — no issues detected.


Generated by Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants