fix(ci): resilient apt install with per-attempt timeout + retry, drop dead-weight packages - #165
Merged
Merged
Conversation
… dead-weight packages The 2026-07-10 nightly diff-fuzz run died in "Install C++ build deps": the Azure archive mirror served cmake (11.2 MB) at ~26 KB/s — 433s for that single package — and the plain `timeout 600` tripped mid-download (exit 124) before any real work started. Same failure class as #125 (2026-06-18), which was "fixed" by bumping 300s -> 600s; a bigger static timeout just moves the cliff. Two-layer fix: 1. scripts/ci-apt-install.sh — shared resilient wrapper: apt-get update + install with up to 3 attempts, each under its own per-attempt timeout (default 300s), backoff between attempts, and `dpkg --configure -a` repair after a kill. A crawling mirror now turns into "kill and retry" (rotation usually lands a healthy endpoint) instead of "burn the whole budget and die". Acquire::Retries covers in-attempt connection drops; DPkg::Lock::Timeout waits out competing lock holders. 2. Slim the package lists to what the runner image actually lacks: - cmake: preinstalled (3.31+, newer than apt's 3.28 and earlier in PATH — the apt copy was pure dead weight, and #164's fatal download was exactly this package) - ninja-build: nothing in the repo uses -G Ninja (unified Makefile builds use the default generator); dead since the pre-Makefile era - build-essential / g++-13: gcc-13 + make preinstalled on noble - libhiredis-dev (ci.yml differential-fuzz job): pine-cpp's redis client is raw-socket; no hiredis reference anywhere in the tree Kept: libluajit-5.1-dev, libcurl4-openssl-dev (真 missing), util-linux (sanitizer jobs), redis-server=5:7.* (cross-validate). Install steps now assert preinstalled tools (cmake --version / g++ --version) so an image change fails loudly at install time, not at first compile. All 12 apt sites across ci.yml / nightly-diff-fuzz / nightly-benchmark / nightly-sanitizer / daily-sanitized-fuzz migrated. Worst-case per site: 3 x 300s + backoff ≈ 15.5m, but the expected path is one ~30s attempt — smaller download surface (15.7 MB -> ~1.5 MB on the #164 manifest) shrinks the slow-mirror exposure window ~10x. Verified with a mocked sudo: hang-then-recover (attempt 1 killed at per-attempt timeout, attempt 2 succeeds, exit 0), hard failure (exit 1 after N attempts), empty args (usage, exit 2), and versioned-glob passthrough (redis-server=5:7.*). Closes #164.
Contributor
🔍 PR 审查
改动干净、动机清晰:用「per-attempt timeout + retry」替代静态 核验结果:
|
- guides/ci-quality-baseline.md: new "CI apt 依赖安装约定" section — all workflows must install apt deps via scripts/ci-apt-install.sh (retry + per-attempt timeout; #125/#164 history), package lists only cover what the runner image actually lacks, preinstalled tools get version assertions; retrieval pointer added. - index.md: sync ci-quality-baseline entry; add reflection entry. - memory/reflections/ci-apt-resilience-and-dead-weight-packages.md: new reflection — retry-layer-vs-bigger-timeout decision criterion (does the failure mode self-heal on retry?), dead-weight packages amplify slow-mirror exposure 10x, dependency assertions beat implicit preinstalls, go fuzz "context deadline exceeded" without a crash corpus is a coordinator flake.
Contributor
🔍 PR 增量审查
增量改动纯文档( 核验结果:
三份文档( 审查截止: f667e97 |
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.
Summary
The 2026-07-10 nightly diff-fuzz run (#164) died in "Install C++ build deps": the Azure archive mirror served cmake (11.2 MB) at ~26 KB/s — 433s for that one package — and the plain
timeout 600tripped mid-download (exit 124) before any real work started. Same failure class as #125 (2026-06-18), which was "fixed" by bumping the timeout 300s→600s. A bigger static timeout just moves the cliff.Root cause
cmake— which the runner image already preinstalls (3.31+, newer than apt's 3.28, and earlier inPATH; the apt copy was never used).ninja-buildhas no-G Ninjareference anywhere in the repo;build-essential/g++-13are preinstalled on noble;libhiredis-devis unused (pine-cpp redis client is raw-socket). 15.7 MB of archives on the Nightly diff-fuzz: workflow failed (2026-07-10) #164 manifest vs ~1.5 MB actually needed — a ~10x larger slow-mirror surface.Changes
scripts/ci-apt-install.sh(new): shared resilient wrapper —apt-get update+install, up to 3 attempts each under a per-attempt timeout (default 300s), backoff between attempts,dpkg --configure -arepair after a mid-unpack kill,Acquire::Retries=3(in-attempt connection drops) +DPkg::Lock::Timeout=60(competing lock holders).ci.yml(7) /nightly-diff-fuzz/daily-sanitized-fuzz/nightly-benchmark/nightly-sanitizer(2), with package lists slimmed to what the image actually lacks (libluajit-5.1-dev,libcurl4-openssl-dev, plusutil-linuxfor sanitizer jobs andredis-server=5:7.*for cross-validate).cmake --version/g++-13 --version) so a future runner-image change fails loudly at install time instead of at first compile.Worst case per site: 3 × 300s + backoff ≈ 15.5m (vs old 20m budget); expected path is a single ~30s attempt.
Test plan
bash -n+ workflow YAML parse (all 8 files)redis-server=5:7.*reaches apt verbatim, unexpanded)working-directoryinterference), checkout precedes every callci.ymlsites live — cpp-build / cpp-sanitizer / cpp-tsan / cpp-lint / cpp-test / cross-validate / differential-fuzz all exercise the new scriptCloses #164.