Skip to content

ngclient: Retry transient HTTP errors - #3057

Open
Sauvi72 wants to merge 1 commit into
theupdateframework:developfrom
Sauvi72:fix/issue-3044-http-retries
Open

Sauvi72 wants to merge 1 commit into
theupdateframework:developfrom
Sauvi72:fix/issue-3044-http-retries

Conversation

@Sauvi72

@Sauvi72 Sauvi72 commented Nov 22, 2026

Copy link
Copy Markdown

Description of the changes being introduced by the pull request:

Urllib3Fetcher uses urllib3's default retry policy, which does not retry HTTP 502, 503 or 504 responses without a Retry-After header. A transient gateway or service failure therefore ends the download immediately.

Configure the existing pool managers to retry these status codes up to three times. Return the last response when retries are exhausted so the fetcher continues to raise DownloadHTTPError with the HTTP status code. Document the retry behavior on Urllib3Fetcher.

Regression tests exercise urllib3's retry loop with simulated HTTP responses. They cover recovery for each status, exhaustion after four attempts, and no retries for 400, 403, 404 and 500 without Retry-After. The recovery and exhaustion cases fail against develop and pass with this change.

Validation: tox passes (211 tests, 98% coverage, Ruff, mypy, zizmor and Sphinx documentation build), using Python 3.14 on macOS.

Fixes #3044

Retry HTTP 502, 503 and 504 responses up to three times, including when Retry-After is absent. Preserve DownloadHTTPError and its status code when retries are exhausted.

Add regression tests for recovery, exhausted retries and non-retryable responses.

Fixes theupdateframework#3044

Signed-off-by: saurav kumar <krsauvi@gmail.com>
@Sauvi72
Sauvi72 marked this pull request as ready for review November 22, 2026 19:01
@Sauvi72
Sauvi72 requested a review from a team as a code owner November 22, 2026 19:01
@Sauvi72

Sauvi72 commented Nov 22, 2026

Copy link
Copy Markdown
Author

@jku, could you review this fix for #3044 and approve the workflow runs? They currently report action_required. Local tox passes all 211 tests, coverage, lint/type checks and the documentation build. The tests cover recovery from 502/503/504, retry exhaustion preserving DownloadHTTPError, and errors that should not be retried.

This branch has not been deployed

No deployments
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.

no retries on HTTP 5xx errors

1 participant