Skip to content

backend/Dockerfile: retry apt-get on transient mirror 404s - #757

Merged
fangge518 merged 1 commit into
devfrom
fix/backend-dockerfile-apt-retry
Sep 4, 2026
Merged

backend/Dockerfile: retry apt-get on transient mirror 404s#757
fangge518 merged 1 commit into
devfrom
fix/backend-dockerfile-apt-retry

Conversation

@fangge518

Copy link
Copy Markdown
Collaborator

`deb.debian.org` is a CDN in front of many mirror origins. A `-security` point-release rotation can leave one edge's index listing a filename another edge has already purged, producing a 404 mid-`apt-get install` that a single attempt can't recover from.

Fix: wrap `apt-get update && apt-get install` in a retry loop (5 attempts, 10s apart) — a fresh `apt-get update` on retry usually lands on a consistent edge.

Verified

  • Hit this live: PR Add Freedom to Vote test and configurable competitiveness metrics to the evaluation panel #723's AWS Preview build failed 3 times in a row today on 3 different packages (`libtiff`, `libc-l10n`, `libperl`); today's `dev` deploy hit the same `libc-l10n` 404.
  • Reproduced locally against the unmodified Dockerfile (a 4th distinct package, `libde265-0`) while testing the fix, confirming this is an active, ongoing mirror issue rather than one bad file.
  • With the fix: full `docker build --platform linux/amd64` succeeds end-to-end (matches real CI architecture); the retry loop itself recovered from the same live flakiness during a local build.
  • Checked `deploy-api.yml`'s last ~30 runs: this has never caused a deploy failure before now — its only 2 historical failures were unrelated migration-task issues.

deb.debian.org is a CDN in front of many mirror origins; a -security
point-release rotation can leave one edge's index listing a filename
another edge has already purged, producing a 404 an apt-get install
can't recover from mid-run. Wrapping update+install in a retry loop
lets a fresh apt-get update (which usually lands on a consistent edge)
resolve it within the same build, instead of needing a whole CI job
rerun.

Verified live: this branch's AWS Preview workflow hit this exact
failure 3 times in a row on 3 different packages (libtiff, libc-l10n,
libperl); reproduced locally against the unmodified Dockerfile
(libde265-0, arm64) while testing the fix. Confirmed the retry loop
itself works (recovered from the same live mirror flakiness during a
local arm64 build) and that the full build succeeds end-to-end on
linux/amd64 (the real CI architecture) with the fix applied.

No deploy-api.yml failure has ever been caused by this — checked its
last ~30 runs; its only 2 failures were unrelated migration-task
issues, apt-get succeeded in both. Folding this into #723 rather than
a separate PR so the fix gets verified through this branch's own
preview deploy, which is already hitting the failure live.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@fangge518
fangge518 merged commit b9bb293 into dev Sep 4, 2026
2 checks passed
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.

1 participant