From 50464702d2d22b08bd2c2d3b7c057212a95ca395 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 4 Aug 2026 16:14:20 -0700 Subject: [PATCH] ci: key the Rust cargo cache on the toolchain that built it (#10568) Key the Rust cargo cache on the toolchain that built it The cache key was rust- with a bare rust- restore prefix, so one seaweed-volume/target survived across runner images. cargo tracks its own inputs but not the runner's C toolchain, so build-script output for C dependencies is reused even when the system libc underneath it changed. That is how the Rust jobs got wedged: the cached aws-lc-sys objects reference __isoc23_sscanf and __isoc23_strtol, symbols glibc only grew in 2.38, while the jobs link on ubuntu-22.04 with glibc 2.35. Every job died at rust-lld: error: undefined symbol: __isoc23_sscanf >>> referenced by bcm.c in archive libaws_lc_sys-*.rlib with nothing in the tree to explain it, and no amount of re-running helped because the poisoned entry was hit every time. Fold the glibc and rustc versions into the key so a toolchain change misses the cache and rebuilds instead of producing an unlinkable target/. --- .../workflows/rust-volume-server-tests.yml | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust-volume-server-tests.yml b/.github/workflows/rust-volume-server-tests.yml index 2ed2e90c2..7626fd93a 100644 --- a/.github/workflows/rust-volume-server-tests.yml +++ b/.github/workflows/rust-volume-server-tests.yml @@ -42,6 +42,12 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + # cargo tracks its own inputs but not the runner's C toolchain, so a cached + # target/ can carry C objects built against a different glibc than we link against. + - name: Fingerprint build toolchain + id: toolchain + run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" + - name: Cache cargo registry and target uses: actions/cache@v6 with: @@ -49,9 +55,9 @@ jobs: ~/.cargo/registry ~/.cargo/git seaweed-volume/target - key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }} + key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock') }} restore-keys: | - rust- + rust-${{ steps.toolchain.outputs.fingerprint }}- - name: Build Rust volume server run: cd seaweed-volume && cargo build --release @@ -79,6 +85,12 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + # cargo tracks its own inputs but not the runner's C toolchain, so a cached + # target/ can carry C objects built against a different glibc than we link against. + - name: Fingerprint build toolchain + id: toolchain + run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" + - name: Cache cargo registry and target uses: actions/cache@v6 with: @@ -86,9 +98,9 @@ jobs: ~/.cargo/registry ~/.cargo/git seaweed-volume/target - key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }} + key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock') }} restore-keys: | - rust- + rust-${{ steps.toolchain.outputs.fingerprint }}- - name: Build Go weed binary run: | @@ -155,6 +167,12 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + # cargo tracks its own inputs but not the runner's C toolchain, so a cached + # target/ can carry C objects built against a different glibc than we link against. + - name: Fingerprint build toolchain + id: toolchain + run: echo "fingerprint=$(getconf GNU_LIBC_VERSION | tr ' ' '-')-rustc-$(rustc -V | awk '{print $2}')" >> "$GITHUB_OUTPUT" + - name: Cache cargo registry and target uses: actions/cache@v6 with: @@ -162,9 +180,9 @@ jobs: ~/.cargo/registry ~/.cargo/git seaweed-volume/target - key: rust-${{ hashFiles('seaweed-volume/Cargo.lock') }} + key: rust-${{ steps.toolchain.outputs.fingerprint }}-${{ hashFiles('seaweed-volume/Cargo.lock') }} restore-keys: | - rust- + rust-${{ steps.toolchain.outputs.fingerprint }}- - name: Build Go weed binary run: |