Repository navigation
CI: rank apt mirrors by speed so a slow Azure mirror cannot time out apt steps - #15350
Merged
Merged
Conversation
…eat the step budget [skip ci]
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Why apt steps started timing out
Since about Oct 22,
azure.archive.ubuntu.comon GitHub-hosted Ubuntu runners has been serving some runners at a few tens of KB/s for hours at a time (actions/runner-images#14823, #15040). The images send apt throughmirror+file:/etc/apt/apt-mirrors.txtwith the Azure mirror first, and apt only fails over to the next entry on an error. A slow transfer is still a live transfer, soAcquire::http::Timeoutnever fires and every retry inretry-with-apt-lock.shdownloads from the same slow node.That is what killed the Tauri smoke build on staging: the 55 MB WebKitGTK install fetched at roughly 35 KB/s, both 360 s attempts were cut off, and the 15 minute step limit ended the job. A timed-out attempt also left its
apt-getrunning undersudo, still holding the dpkg lock, so the second attempt opened withCould not get lock /var/lib/dpkg/lock-frontend.Fix
All in
.github/scripts/retry-with-apt-lock.sh, so every workflow that already goes through the helper picks it up:apt-mirrors.txtis timed on a 5 s fetch ofdists/<codename>/main/binary-<arch>/Packages.gz, and the file is rewritten fastest first.http://archive.ubuntu.com/ubuntu/is added as a candidate beside an*.archive.ubuntu.commirror;ports.ubuntu.com(arm64) is left alone. A healthy Azure mirror stays first, since it is normally the fastest.apt-get/aptprocesses are stopped anddpkg --configure -aruns before the lock wait, so the retry does not start against a lock held by the previous attempt.APT_PREFER_FAST_MIRROR=0turns the mirror handling off. Without/etc/apt/apt-mirrors.txtorcurlthe helper behaves exactly as before.Tests
tests/studio/test_apt_mirror_preference.pyruns the real helper against a temporary mirror file withsudo,curl,pkill,dpkgandfuserstubbed onPATH: fastest mirror first, a fast Azure mirror keeps its place, a failed attempt demotes the leader, ranking happens once per job, ports mirrors get no global archive, the opt-out and a missing mirror file leave things untouched.test_apt_steps_are_bounded.pynow counts the probe (up to 4 x 5 s per job) and the 2 s orphan stop in each step's worst case; every existing step budget still fits.azure.archive.ubuntu.com,archive.ubuntu.comandsecurity.ubuntu.com.