From b570f107623f18a3c3495c2d6b8408cd7b1c7972 Mon Sep 17 00:00:00 2001 From: albertwujj Date: Thu, 19 Nov 2026 12:49:53 -0800 Subject: [PATCH 1/2] Compile the library one crate at a time on the macOS runners Kani compiles all the harnesses of a crate in one compiler process, and `kani list`, the first step of every partition job (and of the metrics and list jobs), compiles every harness of the library. On the 7 GB macOS runners the compiler of `core` is killed when the compiler of another crate with many harnesses runs beside it: the job then ends with "The hosted runner lost communication with the server", before any harness runs. scripts/run-kani.sh now sets CARGO_BUILD_JOBS=1 on macOS once Kani is built, so cargo compiles the crates of the library one after the other. The Linux runners (16 GB) are not changed. --- scripts/run-kani.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/run-kani.sh b/scripts/run-kani.sh index 55227b2921c11..16115b4dc9cd3 100755 --- a/scripts/run-kani.sh +++ b/scripts/run-kani.sh @@ -283,6 +283,13 @@ main() { kani_path=$(get_kani_path "$build_dir") echo "Kani executable path: $kani_path" + # On macOS, compile the library one crate at a time. Kani compiles all the harnesses of a + # crate in one compiler process, and the 7 GB macOS runners kill the compiler of `core` + # when the compiler of another crate with many harnesses (`alloc`) runs beside it. + if [[ "$(uname)" == "Darwin" ]]; then + export CARGO_BUILD_JOBS=1 + fi + echo "Running Kani command..." "$kani_path" --version From 45e1b30acb746d9aeb4a2e1889f1603305259519 Mon Sep 17 00:00:00 2001 From: albertwujj Date: Fri, 20 Nov 2026 13:50:19 -0800 Subject: [PATCH 2/2] Set CARGO_BUILD_JOBS for the macOS runners in kani.yml, not in run-kani.sh As asked in review: the setting belongs to the CI runners, where KANI_JOBS is set for Ubuntu. In scripts/run-kani.sh it also applied to anyone who runs the script on a Mac, and it overrode a value they had already set. This restores scripts/run-kani.sh and sets CARGO_BUILD_JOBS to 1 for macos-latest in the partition job. The other runners get `default`, because cargo rejects an empty value. --- .github/workflows/kani.yml | 5 +++++ scripts/run-kani.sh | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/kani.yml b/.github/workflows/kani.yml index d93b0ecc26b16..a2a8d088ff9d6 100644 --- a/.github/workflows/kani.yml +++ b/.github/workflows/kani.yml @@ -48,6 +48,11 @@ jobs: # runners get OOM-killed when 4 memory-hungry harnesses (up to ~10 GB # each, e.g. the ffi::c_str ones) run concurrently. KANI_JOBS: ${{ matrix.os == 'ubuntu-latest' && 2 || '' }} + # Compile one library crate at a time on macos-latest: its 7 GB runners + # kill the compiler of `core` when the compiler of another crate with + # many harnesses runs beside it. The other runners keep cargo's default + # (cargo rejects an empty value). + CARGO_BUILD_JOBS: ${{ matrix.os == 'macos-latest' && 1 || 'default' }} steps: - name: Remove unnecessary software to free up disk space diff --git a/scripts/run-kani.sh b/scripts/run-kani.sh index 16115b4dc9cd3..55227b2921c11 100755 --- a/scripts/run-kani.sh +++ b/scripts/run-kani.sh @@ -283,13 +283,6 @@ main() { kani_path=$(get_kani_path "$build_dir") echo "Kani executable path: $kani_path" - # On macOS, compile the library one crate at a time. Kani compiles all the harnesses of a - # crate in one compiler process, and the 7 GB macOS runners kill the compiler of `core` - # when the compiler of another crate with many harnesses (`alloc`) runs beside it. - if [[ "$(uname)" == "Darwin" ]]; then - export CARGO_BUILD_JOBS=1 - fi - echo "Running Kani command..." "$kani_path" --version