Repository navigation
fix(fetch): retry transient chunk and pack GET timeouts - #91
Merged
Merged
Conversation
Stub retry_transient_get_with makes a single attempt; the new tests fail until the retry loop is implemented in the next commit. [AI-assisted - Claude]
Clone/fetch GETs of the manifest, each chunk and single packs now retry on GET timeout or host backpressure (3 attempts by default, override with FREENET_GIT_CHUNK_RETRIES; 1 disables). NotFound, hash mismatch and hard errors are not retried. One stderr line per retry. [AI-assisted - Claude]
…ting (#36) [AI-assisted - Claude]
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.
Problem
A single pack or chunk GET that times out fails the whole clone or fetch (#36). On a slow or busy gateway, a large chunked clone such as the freenet-core mirror can fail on every attempt, because some chunk always hits the 180s timeout.
Approach
wsclient::retry_transient_getretries a GET only when it fails transiently: a timeout or gateway backpressure, using the existingProbeOutcome/retry_dispositionclassification andretry_backoff. NotFound (authoritative, per the existing convention), hash mismatches and hard errors such as a closed connection are not retried.chunked.rsand theSinglePackGET indownload_bundle.rescueand the publish-verification GETs are unchanged.FREENET_GIT_CHUNK_RETRIESoverrides this; an invalid value warns and falls back to the default, and1disables retrying.dispatch_get_response.Trade-off: when the gateway is completely unreachable, a clone takes up to about 3 times longer to fail (about 9 minutes per chunk in the worst case).
Testing
The tests were written first and failed on a single-attempt stub (4 retry tests plus the parser test), then passed with the fix:
retry_get_succeeds_after_one_timeoutretry_get_retries_host_backpressureretry_get_gives_up_after_n_attempts_keeping_timeout_textretry_get_does_not_retry_hash_mismatch_or_hard_errorsretry_get_does_not_retry_authoritative_not_foundretry_get_one_attempt_means_no_retry_and_unwrapped_errorretry_get_total_backoff_is_boundedparse_fetch_get_attempts_handles_all_inputscargo test -p freenet-git, fmt and clippy (CI flags) are clean.Review: Codex found nothing actionable. A skeptical lens found nothing blocking; its non-blocking points (wall time when the gateway is down, no test pinning that the lock is released before the sleep) are covered by the README note and the trade-off above.
Closes #36
[AI-assisted - Claude]