From df295d95299718a437a73fcaad180d35ad9698d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 07:44:12 +0000 Subject: [PATCH 1/3] fix(mutation): exclude the next_frame mutants that exhaust the runner's memory The cargo-mutants job was stopped by the runner ("received a shutdown signal") in every master run checked (7 to 12), 9 to 20 minutes in. The disk was not the cause, as the last change assumed: the runner had 86 GB free. Memory was. The three mutants that make FrameReader::next_frame return Ok(vec![]), Ok(vec![0]) or Ok(vec![1]) at once fail four frame_io unit tests each (checked by applying them by hand), but the slave's read loop in the same test binary spins on the frames it is handed and grows until memory runs out: from 14 GB to under 2 GB available in about 30 s, measured for each of the three. With -j 2 on a 16 GB runner the kernel then kills the runner itself. They are excluded with that reason, like the other analysed exclusions; 221 mutants remain. The workflow comment no longer blames the disk; the build without debug info stays (1.7 GB of target instead of 4.0 GB). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Rdii6QU3MVeyCefPEk5AL --- .github/workflows/mutation.yml | 8 ++++---- src-tauri/.cargo/mutants.toml | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 35fa852..a59edf4 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -24,10 +24,10 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 90 env: - # Test builds without debug info, which mutation testing does not use. The job used to be - # stopped by the runner after 14-20 minutes, five runs in a row: measured on 2026-11-06 with - # the same flags, target is 4.0 GB and cargo-mutants' two build copies 9 GB, against the - # 14 GB disk of a standard runner. Without debug info target is 1.7 GB. + # Test builds without debug info, which mutation testing does not use: target is 1.7 GB + # instead of 4.0 GB (measured 2026-11-06), and the builds are faster. The disk was not what + # stopped the job, as first thought: the runner had 86 GB free. Memory was, see the + # next_frame exclusion in src-tauri/.cargo/mutants.toml. CARGO_PROFILE_DEV_DEBUG: "0" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 diff --git a/src-tauri/.cargo/mutants.toml b/src-tauri/.cargo/mutants.toml index de0cac8..1217527 100644 --- a/src-tauri/.cargo/mutants.toml +++ b/src-tauri/.cargo/mutants.toml @@ -19,4 +19,10 @@ exclude_re = [ # Only differ on real accept()/recv() errors (e.g. EMFILE), not reproducible deterministically. 'replace match guard e\.kind\(\) == io::ErrorKind::WouldBlock with true in accept_loop', 'replace match guard crate::frame_io::is_timeout\(&e\) with true in udp_loop', + # Caught, but they take the runner down: each fails four frame_io unit tests at once, while the + # slave's read loop in the same test binary spins on the frames it is handed at once and grows + # until memory runs out (measured 2026-11-06: from 14 GB to under 2 GB available in about + # 30 s). On the CI runner that killed the job with "received a shutdown signal" before any + # result, in every run checked (7 to 12). + 'replace FrameReader::next_frame -> Result, FrameError> with Ok\(vec!\[', ] From 23c2dc2aec5b9b047eceea8b8bee80905436e5c4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 08:06:51 +0000 Subject: [PATCH 2/3] ci(mutation): exclude the complete_len Ok(Some(0)) runaway mutant The full local run stopped on memory while this mutant ran. Measured alone (2026-11-07): available memory fell from 14.8 GB to 1.8 GB in 26 s, because an empty frame leaves the buffer unchanged and the slave's read loop is handed one empty frame after another. Applied by hand it fails 10 of the 11 frame_io unit tests, so the exclusion hides no gap. Ok(None) and Ok(Some(1)) were measured too: both caught, memory flat. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Rdii6QU3MVeyCefPEk5AL --- src-tauri/.cargo/mutants.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src-tauri/.cargo/mutants.toml b/src-tauri/.cargo/mutants.toml index 1217527..cf89c9b 100644 --- a/src-tauri/.cargo/mutants.toml +++ b/src-tauri/.cargo/mutants.toml @@ -25,4 +25,8 @@ exclude_re = [ # 30 s). On the CI runner that killed the job with "received a shutdown signal" before any # result, in every run checked (7 to 12). 'replace FrameReader::next_frame -> Result, FrameError> with Ok\(vec!\[', + # Same runaway: an empty frame leaves the buffer as it is, so next_frame hands the read loop + # one empty frame after another (measured 2026-11-07: from 14.8 GB to 1.8 GB available in + # 26 s). Applied by hand it fails 10 of the 11 frame_io unit tests. + 'replace FrameReader::complete_len -> Result, FrameError> with Ok\(Some\(0\)\)', ] From fc24f0fbf13c0ff89939447094475846f84eec2b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 08:26:50 +0000 Subject: [PATCH 3/3] ci(mutation): cap the test binaries' memory instead of excluding runaway mutants Mutants that make FrameReader::next_frame, complete_len or Master::receive hand back frames at once make a read loop spin and grow the tests' traffic log until memory runs out. Excluding them one by one did not end: the full local run found three more (Master::receive) after the first two exclusions, with 66 mutants still untested. Measured 2026-11-07: each such mutant takes available memory from 14.8 GB to under 2 GB in 25-30 s. Test binaries now run under a 4 GiB address-space cap through cargo's target runner (scripts/memory-capped.sh); builds are not capped. With it the unmutated tests pass and all 7 runaway mutants are caught, by a failed allocation, in 62 s, with memory never under 12.6 GB. The two exclusions are dropped, so those mutants are tested again. The disk prints go: the disk was not the cause, the runner had 86 GB free. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Rdii6QU3MVeyCefPEk5AL --- .github/workflows/mutation.yml | 21 +++++++++------------ scripts/memory-capped.sh | 6 ++++++ src-tauri/.cargo/mutants.toml | 10 ---------- 3 files changed, 15 insertions(+), 22 deletions(-) create mode 100755 scripts/memory-capped.sh diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index a59edf4..542a3a2 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -25,10 +25,16 @@ jobs: timeout-minutes: 90 env: # Test builds without debug info, which mutation testing does not use: target is 1.7 GB - # instead of 4.0 GB (measured 2026-11-06), and the builds are faster. The disk was not what - # stopped the job, as first thought: the runner had 86 GB free. Memory was, see the - # next_frame exclusion in src-tauri/.cargo/mutants.toml. + # instead of 4.0 GB (measured 2026-11-06), and the builds are faster. CARGO_PROFILE_DEV_DEBUG: "0" + # Test binaries run under a 4 GiB cap (scripts/memory-capped.sh); the builds do not. Some + # mutants (FrameReader::next_frame, complete_len, Master::receive handing back frames at + # once) make a read loop spin and grow the tests' traffic log until memory runs out: the + # runner died with "received a shutdown signal" before any result (runs 7 to 12; the disk + # was not the cause, 86 GB were free). Measured 2026-11-07: without the cap, 14.8 GB to + # under 2 GB available in 25-30 s per mutant; with it, the unmutated tests pass and the 7 + # such mutants are caught in 62 s, memory never under 12.6 GB. + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: ${{ github.workspace }}/scripts/memory-capped.sh steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: @@ -64,10 +70,6 @@ jobs: if: steps.results.outputs.cache-hit != 'true' run: mkdir -p dist - - name: Disk before mutating - if: steps.results.outputs.cache-hit != 'true' - run: df -h / && (du -sh src-tauri/target || true) - # --copy-target starts every scratch build from the restored dependency cache instead of # a cold build. Scope and analysed exclusions: src-tauri/.cargo/mutants.toml. The exit code # is stored with the results so a cached run is judged like a fresh one. @@ -79,11 +81,6 @@ jobs: cargo mutants -j 2 --timeout 60 --copy-target=true echo $? > mutants.out/exit-code - # Also after a failure: whether the disk was the limit is the question this answers. - - name: Disk after mutating - if: always() && steps.results.outputs.cache-hit != 'true' - run: df -h / - # Saved when the gate fails too: a measurement stays a measurement for this commit. # A run that did not finish (baseline failure, crash) is not saved. - name: Save this commit's mutation results diff --git a/scripts/memory-capped.sh b/scripts/memory-capped.sh new file mode 100755 index 0000000..3365956 --- /dev/null +++ b/scripts/memory-capped.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Runs a test binary with at most 4 GiB of address space, for mutation testing: a mutant that +# makes a loop spin fills the tests' traffic log until the runner dies with no result. Under +# the cap the allocation fails, the test aborts, and the mutant counts as caught. +ulimit -v 4194304 +exec "$@" diff --git a/src-tauri/.cargo/mutants.toml b/src-tauri/.cargo/mutants.toml index cf89c9b..de0cac8 100644 --- a/src-tauri/.cargo/mutants.toml +++ b/src-tauri/.cargo/mutants.toml @@ -19,14 +19,4 @@ exclude_re = [ # Only differ on real accept()/recv() errors (e.g. EMFILE), not reproducible deterministically. 'replace match guard e\.kind\(\) == io::ErrorKind::WouldBlock with true in accept_loop', 'replace match guard crate::frame_io::is_timeout\(&e\) with true in udp_loop', - # Caught, but they take the runner down: each fails four frame_io unit tests at once, while the - # slave's read loop in the same test binary spins on the frames it is handed at once and grows - # until memory runs out (measured 2026-11-06: from 14 GB to under 2 GB available in about - # 30 s). On the CI runner that killed the job with "received a shutdown signal" before any - # result, in every run checked (7 to 12). - 'replace FrameReader::next_frame -> Result, FrameError> with Ok\(vec!\[', - # Same runaway: an empty frame leaves the buffer as it is, so next_frame hands the read loop - # one empty frame after another (measured 2026-11-07: from 14.8 GB to 1.8 GB available in - # 26 s). Applied by hand it fails 10 of the 11 frame_io unit tests. - 'replace FrameReader::complete_len -> Result, FrameError> with Ok\(Some\(0\)\)', ]