You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky CI: cargo_autoharness_multichareq_searcher times out on macos-15-intel and fails the merge queue #5162
Priority: Urgent. This test is ejecting PRs from the merge queue.
script-based-pre/cargo_autoharness_multichareq_searcher, added in #5064, times out on the regression (macos-15-intel) runner. The test runs autoharness with --harness-timeout 10m; on that runner char_slice_value exceeds it ("CBMC timed out"), so the expected line never prints:
The other harnesses in the test already take 90–450s on that runner, and the whole test takes about 25 minutes, close to compiletest's 2400s per-test limit. Linux runners pass it.
Disabled for now in #5163 (renamed to cargo_autoharness_multichareq_searcher_fixme) to unblock the merge queue. Keep this issue open to fix and re-enable the test.
Investigation of why this test times out on macos-15-intel. Summary: the harnesses build very large CBMC problems, and the Intel Mac runner slows down disproportionately on large problems. macOS gets the same problem as Linux; nothing is platform-specific.
1. The formulas are the same on both platforms. Per harness, from the #5157 re-run and a local Linux run of the same command:
harness
variables (Linux / macOS)
symex Linux
symex macos-15-intel
haystack_len_is_not_three
1.398M / 1.396M
16.8s
122–254s
char_slice_mut
1.399M / 1.396M
16.9s
80–153s
char_slice_value
1.664M / 1.659M
21.9s
156–242s (times out)
char_array_* (4 harnesses)
0.60–0.67M
7.7–8.6s
20–85s
The symex ranges are across three failing macOS runs (job 131643563642, the #5153 queue job 131648023469, and the #5138 queue job 131640868913).
2. Most of the cost is argument generation.haystack_len_is_not_three only checks s.haystack().len() != 3 and char_slice_mut has one cover, yet both are as large as char_slice_value, which runs the searcher. So most of the formula comes from autoharness building a bounded CharSliceSearcher (an arbitrary UTF-8 &str plus a &[char]).
3. The slowdown grows with size. Symex is 2.5–10× slower than Linux for the 0.6M harnesses and 5–12× for the 1.4–1.7M ones, and the same harness varies 2× between runs. Peak CBMC memory for char_slice_value is about 2.9 GiB, and compiletest runs other script-based-pre tests at the same time on the 14 GB runner. Memory pressure fits better than raw CPU speed. The arm64 macos-15 runner passes the test.
4. Smaller bounds barely help. All expected covers still hold with --string-bound 3 and --slice-bound 2 or 3, but the largest harness only drops from 1.66M to 1.34M variables (about 20%).
Options:
Make the bounded generation of &str/&[char] cheaper. A harness that only reads haystack().len() should not need 1.4M variables. I'll profile where the size comes from next.
In the test, drop or slim the CharSliceSearcher harnesses that check little (haystack_len_is_not_three, char_slice_mut), and use --string-bound 3.
Root cause: autoharness's default unwind of 20 (LOOP_UNWIND_DEFAULT in kani-driver/src/autoharness/mod.rs), not the string or slice bounds.
With --string-bound 4, the haystack has at most 4 bytes, but CBMC cannot see that bound on the symbolic-length loops in core::str::validations::run_utf8_validation (and in the searcher's char decoding), so it unrolls them to the default of 20. A hand-written copy of the generated harness (nondeterministic storage passed to any_str_ref, into_searcher on a nondeterministic-length &[char] prefix, then up to 4 next and 4 next_back steps, as in any_char_slice_searcher) gives:
built
--default-unwind 20
--default-unwind 6
plus the searcher, no steps
359K variables
52K
plus 4 next steps
869K
305K
plus 4 next and 4 next_back steps
1.39M (78s)
570K (22s)
(Edited: the first version of this table zeroed the storage instead of filling it with kani::any(); the sizes barely changed, and with nondeterministic storage the covers that depend on the haystack's contents are now satisfied too.)
The test itself with --default-unwind 6 added (bounds unchanged):
harness
variables at 20 → 6
time at 20 → 6 (Linux)
haystack_len_is_not_three
1.40M → 580K
73s → 20s
char_slice_mut
1.40M → 580K
79s → 21s
char_slice_value
1.66M → 716K
108s → 33s
char_array_*
0.60–0.67M → 0.29–0.37M
31–41s → 9–17s
At unwind 6 all expected covers are still SATISFIED, all 17 unwinding assertions are SUCCESS (so every loop is still fully unrolled, nothing is cut off), and the only failure is the intended haystack().len() != 3.
Kani: with --bounded-arguments, derive the default unwind from the bounds (e.g. the largest of --string-bound/--slice-bound plus a small margin) when the user gives no --default-unwind/--unwind, instead of 20. This stays sound because unwinding assertions are checked: a too-small bound fails verification rather than hiding behavior. Every bounded-argument harness over strings or slices would benefit, not just this test.
Follow-up for Kani itself, in a separate PR: with --bounded-arguments, derive the default unwind from the bounds (e.g. the largest of --string-bound / --slice-bound plus a small margin) when neither --default-unwind nor --unwind is given, instead of the fixed 20 (LOOP_UNWIND_DEFAULT). This stays sound because unwinding assertions are checked: a bound below a loop's real trip count fails verification rather than hiding behavior. Every bounded-argument harness over strings or slices would benefit.
Activity
feliperodri commentedon Nov 13, 2026
Disabled for now in #5163 (renamed to
cargo_autoharness_multichareq_searcher_fixme) to unblock the merge queue. Keep this issue open to fix and re-enable the test.feliperodri commentedon Nov 13, 2026
Investigation of why this test times out on
macos-15-intel. Summary: the harnesses build very large CBMC problems, and the Intel Mac runner slows down disproportionately on large problems. macOS gets the same problem as Linux; nothing is platform-specific.1. The formulas are the same on both platforms. Per harness, from the #5157 re-run and a local Linux run of the same command:
haystack_len_is_not_threechar_slice_mutchar_slice_valuechar_array_*(4 harnesses)The symex ranges are across three failing macOS runs (job 131643563642, the #5153 queue job 131648023469, and the #5138 queue job 131640868913).
2. Most of the cost is argument generation.
haystack_len_is_not_threeonly checkss.haystack().len() != 3andchar_slice_muthas one cover, yet both are as large aschar_slice_value, which runs the searcher. So most of the formula comes from autoharness building a boundedCharSliceSearcher(an arbitrary UTF-8&strplus a&[char]).3. The slowdown grows with size. Symex is 2.5–10× slower than Linux for the 0.6M harnesses and 5–12× for the 1.4–1.7M ones, and the same harness varies 2× between runs. Peak CBMC memory for
char_slice_valueis about 2.9 GiB, and compiletest runs otherscript-based-pretests at the same time on the 14 GB runner. Memory pressure fits better than raw CPU speed. The arm64macos-15runner passes the test.4. Smaller bounds barely help. All expected covers still hold with
--string-bound 3and--slice-bound 2or3, but the largest harness only drops from 1.66M to 1.34M variables (about 20%).Options:
&str/&[char]cheaper. A harness that only readshaystack().len()should not need 1.4M variables. I'll profile where the size comes from next.CharSliceSearcherharnesses that check little (haystack_len_is_not_three,char_slice_mut), and use--string-bound 3.macos-15-intelmeanwhile (Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163).feliperodri commentedon Nov 13, 2026
Root cause: autoharness's default unwind of 20 (
LOOP_UNWIND_DEFAULTinkani-driver/src/autoharness/mod.rs), not the string or slice bounds.With
--string-bound 4, the haystack has at most 4 bytes, but CBMC cannot see that bound on the symbolic-length loops incore::str::validations::run_utf8_validation(and in the searcher's char decoding), so it unrolls them to the default of 20. A hand-written copy of the generated harness (nondeterministic storage passed toany_str_ref,into_searcheron a nondeterministic-length&[char]prefix, then up to 4nextand 4next_backsteps, as inany_char_slice_searcher) gives:--default-unwind 20--default-unwind 6nextstepsnextand 4next_backsteps(Edited: the first version of this table zeroed the storage instead of filling it with
kani::any(); the sizes barely changed, and with nondeterministic storage the covers that depend on the haystack's contents are now satisfied too.)The test itself with
--default-unwind 6added (bounds unchanged):haystack_len_is_not_threechar_slice_mutchar_slice_valuechar_array_*At unwind 6 all expected covers are still
SATISFIED, all 17 unwinding assertions areSUCCESS(so every loop is still fully unrolled, nothing is cut off), and the only failure is the intendedhaystack().len() != 3.Suggested fixes:
--default-unwind 6tomultichareq-searcher.shand re-enable the test (rename the directory back from Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163).--bounded-arguments, derive the default unwind from the bounds (e.g. the largest of--string-bound/--slice-boundplus a small margin) when the user gives no--default-unwind/--unwind, instead of 20. This stays sound because unwinding assertions are checked: a too-small bound fails verification rather than hiding behavior. Every bounded-argument harness over strings or slices would benefit, not just this test.Lower the default unwind in cargo_autoharness_multichareq_searcher
feliperodri commentedon Nov 13, 2026
Status:
--default-unwind 6(commit d07a0ed), which brings it from about 1.4–1.7M to 0.6–0.7M variables for theCharSliceSearcherharnesses. Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163 (disabling the test) is closed.--bounded-arguments, derive the default unwind from the bounds (e.g. the largest of--string-bound/--slice-boundplus a small margin) when neither--default-unwindnor--unwindis given, instead of the fixed 20 (LOOP_UNWIND_DEFAULT). This stays sound because unwinding assertions are checked: a bound below a loop's real trip count fails verification rather than hiding behavior. Every bounded-argument harness over strings or slices would benefit.Keeping this issue open for that follow-up.
feliperodri commentedon Nov 17, 2026
The broader question of how Kani should model strings (UTF-8 as a type invariant, contracts for validation and iteration) is tracked in #5187.
Reset memory initialization state in automatic harnesses (model-check…