Repository navigation
Description
Build & Test (desk-linux) can never go green on a PR branch: 2GB rust-cache blob aborts restore at the ~600s cap
Component: .github/workflows/ci.yml, build job (Build & Test (${{ matrix.os }}))
Affected runner: [self-hosted, desk-linux] (100.96.135.160)
Impact: every PR-branch run of this job is forced cold, then killed at the 900s compile cap.
1. The blob is 2,029,470,155 bytes
Cache key observed in job 119054392243:
Cache Key: v0-rust-desk-linux-stablepin-build-Linux-x64-62b60f75-212eda4f
Restore Key: v0-rust-desk-linux-stablepin-build-Linux-x64-62b60f75
Cache Paths:
/home/kcode-run/.cargo/bin
/home/kcode-run/.cargo/.crates.toml
/home/kcode-run/.cargo/.crates2.json
/home/kcode-run/.cargo/registry
/home/kcode-run/.cargo/git
/home/kcode-run/actions-runner/_work/KCode/KCode/target
Saved size: 2,029,470,155 bytes (~2.03 GB).
2. Every restore aborts at a ~600s time cap, not a size cap
| Job | Blob size | Elapsed | Progress at abort |
|---|---|---|---|
| 119054392243 | 2,029,470,155 | 617s | 37.4% |
| 119055460640 | 2,029,470,155 | 605s | 39.7% |
| 119065565800 | 2,029,470,155 | 600s | 44.0% |
Three different byte counts reached at three different elapsed times, all converging on ~600s
=> the abort is time-based. Observed throughput was only 1.2-1.4 MB/s, so 2 GB needs ~24 min.
Every abort is followed by:
##[warning]Failed to restore: Server failed to authenticate the request. Make sure the value of
Authorization header is formed correctly including the signature.
No cache found.
3. Smaller blobs restore fine
Job 119062133759 restored a 687,972,881-byte blob successfully inside the same window.
The quality, windows-cross-check and windows-build-test jobs hold 687 MB / 880 MB blobs.
So ~688 MB restores; ~2.03 GB does not.
4. The skip cascade
- Restore aborts -> job runs cold.
Build(cargo build --release --target x86_64-unknown-linux-gnu) takes 2453s cold (520s warm).Compile library and binary tests(cargo test --target ... --lib --bins --no-run) then hits its own cap:
##[error]Command exceeded timeout after 900s: .../cargo test --target x86_64-unknown-linux-gnu --lib --bins --no-run
Cold compile extrapolates to ~2990s (634s warm).- Because that step fails,
Post Run Swatinem/rust-cache@v2save is skipped, so the PR branch never saves a cache.
Note this also bites even a successful restore: job 119055460640 restored its 2GB cache successfully
(cache step 641s, 06:37:50 -> 06:48:31), then Build took 1913s (06:48:31 -> 07:20:24) and Compile
still hit the 900s cap at 07:35:48.
5. Ref scoping closes the loop
GitHub Actions caches are scoped by ref. PR branches resolve to refs/pull/N/merge and cannot read
refs/heads/master, which holds the only 2 GB build-job cache. The build-job caches that do exist for
PRs are refs/pull/124/merge and refs/pull/127/merge -- both also ~2 GB, both also abort.
Therefore: every PR-branch run is cold -> 900s compile kill -> save skipped -> the next PR branch is also cold.
6. What actually dominates the blob: target/, not the crate registry
The obvious suspect is the input difference (quality / windows-cross-check / windows-build-test set
cache-all-crates: "true"; the build job does not). That lever runs in the opposite direction.
From Swatinem/rust-cache src/save.ts:
const crates = core.getInput("cache-all-crates").toLowerCase() || "false";
await cleanRegistry(allPackages, crates !== "true");and src/cleanup.ts:
export async function cleanRegistry(packages: Packages, crates = true) {
...
if (!crates) {
core.debug("skipping registry cache and src cleanup");
return; // <- returns EARLY, pruning nothing
}
// only reached when crates === true
pkgSet = new Set(packages.filter((p) => p.name.endsWith("-sys"))...);
// prunes registry/src down to just -sys crates
}So:
cache-all-crates: "true"->crates !== "true"isfalse-> returns early, keeps MORE registry.cache-all-crates: "false"(the default, and this job's value) -> prunesregistry/srcharder.
The build job therefore already has the more aggressively pruned registry, yet the larger blob.
Its registry is not the problem.
target/ is. From src/config.ts:
self.cachePaths = [path.join(CARGO_HOME, "registry"), path.join(CARGO_HOME, "git")];
const cacheTargets = core.getInput("cache-targets").toLowerCase() || "true";
if (cacheTargets === "true") {
self.cachePaths.push(...workspaces.map((ws) => ws.target)); // <- the whole target/ dir
}The build job is the only job that writes a release build and a --lib --bins test compile and
eight integration/e2e compiles into the same target dir, so it carries third-party dependency rlibs for
both profiles. The quality job only runs cargo check (metadata, no codegen) and the
windows-build-test job (880 MB) has a narrower target surface.
7. Proposed fix
Set cache-targets: "false" on the build job's Swatinem/rust-cache@v2 step, which per action.yml
means "only the cargo registry will be cached", and raise the compile/job timeouts to match a
deliberately cold run (compile 900 -> 3300s, timeout-minutes 120 -> 240).
This is not a pure regression in wall-clock: the 2 GB cache is already never successfully restored by
this job on any ref (it aborts), so today the job pays 641s of doomed download and then builds cold
anyway. Registry-only removes the doomed download and makes the restore deterministic.
PR: linked below.
Activity