Skip to content

Flaky CI: cargo_autoharness_multichareq_searcher times out on macos-15-intel and fails the merge queue #5162

Description

@feliperodri

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:

Status: SATISFIED
Description: "char_slice_value: empty haystack"

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.

Failures so far:

Options:

  1. Make the harnesses cheaper: lower --slice-bound / --string-bound from 4 to 3 in multichareq-searcher.sh, if every expected cover is still SATISFIED.
  2. Raise --harness-timeout and run the harnesses in parallel (-j), keeping the whole test under the 2400s limit.
  3. Move the test to slow-tests.yml so it no longer gates the merge queue.

Activity

  1. added
    T-High Priority
    [I] CI / Infrastructure
    Z-Autoharness
    on Nov 13, 2026
  2. self-assigned this
    on Nov 13, 2026
  3. feliperodri commented on Nov 13, 2026

    @feliperodri
    MemberAuthor

    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.

  4. feliperodri commented on Nov 13, 2026

    @feliperodri
    MemberAuthor

    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.
    • Keep the test off macos-15-intel meanwhile (Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163).
  5. feliperodri commented on Nov 13, 2026

    @feliperodri
    MemberAuthor

    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.

    Suggested fixes:

    1. Test: add --default-unwind 6 to multichareq-searcher.sh and re-enable the test (rename the directory back from Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163).
    2. 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.
  6. feliperodri commented on Nov 13, 2026

    @feliperodri
    MemberAuthor

    Status:

    • Upgrade the Rust toolchain to nightly-2026-11-11 #5157 now runs this test with --default-unwind 6 (commit d07a0ed), which brings it from about 1.4–1.7M to 0.6–0.7M variables for the CharSliceSearcher harnesses. Disable cargo_autoharness_multichareq_searcher until #5162 is fixed #5163 (disabling the test) is closed.
    • 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.

    Keeping this issue open for that follow-up.

  7. feliperodri commented on Nov 17, 2026

    @feliperodri
    MemberAuthor

    The broader question of how Kani should model strings (UTF-8 as a type invariant, contracts for validation and iteration) is tracked in #5187.

  8. added
    [E] Performance
    on Nov 17, 2026
  9. added this to the Autoharness milestone on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

T-High PriorityZ-Autoharness[E] Performance[I] CI / Infrastructure

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions