Skip to content

fix(ci): retry the ccache download on a signed-URL expiry (#6062) - #6063

Merged
zackees merged 2 commits into
obs-rust:masterfrom
KelboLive:fix/6062-ccache-download-retry
Dec 1, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
KelboLive:fix/6062-ccache-download-retry

Conversation

@KelboLive

Copy link
Copy Markdown
Contributor

GitHub serves release assets via a short-lived signed redirect, which intermittently expires before the transfer starts and fails the Tier 2 build with urllib.error.HTTPError: HTTP Error 618: jwt:expired. A rerun passes.

RED: test_expired_signed_redirect_is_retried_against_the_original_url fakes one 618 then a successful download. On the old single urlretrieve it failed with the real HTTPError, because the expired hop was never retried.

GREEN: add download_with_retry(), which re-requests the original github.com release URL on each of up to 4 attempts (so every attempt gets a fresh signed redirect) with 0.5 s exponential backoff, retries only HTTP 618, and re-raises other failures immediately. install() still verifies SHA-256 before extraction. Tests also pin the exhausted-retry backoff sequence and that a 404 is not retried.

)

GitHub serves release assets via a short-lived signed redirect, which intermittently expires before the transfer starts and fails the Tier 2 build with urllib.error.HTTPError: HTTP Error 618: jwt:expired. A rerun passes.

RED: test_expired_signed_redirect_is_retried_against_the_original_url fakes one 618 then a successful download. On the old single urlretrieve it failed with the real HTTPError, because the expired hop was never retried.

GREEN: add download_with_retry(), which re-requests the original github.com release URL on each of up to 4 attempts (so every attempt gets a fresh signed redirect) with 0.5 s exponential backoff, retries only HTTP 618, and re-raises other failures immediately. install() still verifies SHA-256 before extraction. Tests also pin the exhausted-retry backoff sequence and that a 404 is not retried.

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Coordinator review: LGTM, and thanks for the quick fix for #6062. Each retry re-requests the original release URL, so GitHub issues a fresh signed redirect, and the SHA-256 check is unchanged. The two self-tests pin the behaviour: one 618 and then a success, and a persistent 618 that surfaces the original error after ATTEMPTS, with backoff of 0.5, 1 and 2 s. I've approved your held runs, and it'll queue once green.

@zackees
zackees enabled auto-merge December 1, 2026 13:21
@zackees

zackees commented Dec 1, 2026

Copy link
Copy Markdown
Member

Coordinator: Format 🔍 / checks fails in the new self-test. The repo's harness turns ResourceWarning into a failure (#2235):

ResourceWarning: Implicitly cleaning up <HTTPError 404: 'Not Found'>
ResourceWarning: close every file and response the test opens (#2235)
unittest test_tier2_front_cache.py: FAIL

An HTTPError built in a test owns a temporary file wrapper. Close each one the test creates, for example with self.addCleanup(failure.close) for the shared failure and inside download() for the per-call one. The 404 in the message also suggests one test path made a real request to a fabricated URL; make sure every path goes through the patched urlretrieve. Run uv run python -m unittest discover -s ci -p test_tier2_front_cache.py -W error::ResourceWarning to check.

…obs-rust#6062)

The test-created HTTPError objects own a temporary file wrapper, and the repo turns ResourceWarning into a failure (obs-rust#2235): the 404 and the persistent 618 re-raised by the helper were never closed. Register addCleanup(failure.close) for both. Verified with -W error::ResourceWarning (the 5 tests pass; only the two pre-existing Windows-only errors remain).
auto-merge was automatically disabled December 1, 2026 13:56

Head branch was pushed to by a user without write access

@KelboLive

Copy link
Copy Markdown
Contributor Author

Fixed in 99b004d1d: both test-created HTTPError objects are now owned and closed via self.addCleanup(failure.close) — the persistent 618 (its last re-raise is intentionally unclosed by the helper) and the 404 (re-raised immediately).

Verified with warnings as errors:

uv run python -W error::ResourceWarning -m unittest <the five tests>   -> 5 passed
uv run python -W error::ResourceWarning -m unittest discover -s ci -p test_tier2_front_cache.py
  -> no ResourceWarning; only the two pre-existing Windows-only errors
     (platform.machine() == "AMD64" KeyError 'env', and the cp1252 YAML read),
     both of which reproduce on unmodified master.

The 404 in the warning is the fabricated error, not a real request: every path calls the patched mod.urllib.request.urlretrieve.

One correction for the rerun command: -W is an interpreter flag and must come before -m, e.g. uv run python -W error::ResourceWarning -m unittest discover -s ci -p test_tier2_front_cache.py; placing it after -m unittest … makes unittest reject it (unrecognized arguments: -W).

New head 99b004d1d; it needs a workflow approval.

@zackees
zackees added this pull request to the merge queue Dec 1, 2026
Merged via the queue into obs-rust:master with commit 820f86f Dec 1, 2026
97 of 99 checks passed
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants