Skip to content

-j N: workers sit idle while one runs the last harnesses serially (rayon chunking in run_until_abort) #4961

Closed

Description

@feliperodri

With --jobs N, the end of a long run degrades to a single worker. run_until_abort (kani-driver/src/harness_runner.rs) runs harnesses with items.par_iter().enumerate().try_for_each(..). rayon splits the slice adaptively into a few large sequential chunks, and once a worker has started a chunk no other worker can take items from it. Harness run times vary by orders of magnitude (from milliseconds to the full --harness-timeout), so a worker can be left with dozens of harnesses while the others have nothing to do.

Measured on kani autoharness -Z autoharness -j 3 --harness-timeout 120s over https://github.com/krakenfx/kraken-cli (kraken-core, 501 harnesses), Kani main at 1640445:

worker harnesses run
Thread 0 125
Thread 1 299
Thread 2 77

Thread 0 ran its last 79 harnesses alone, about 28 of the run's 63 minutes, with Threads 1 and 2 idle and a single cbmc process on the machine. The smaller crates in the same project show the same pattern on a smaller scale.

Suggested fix. Make each harness its own unit of work, so an idle worker can always take the next one:

items.par_iter().with_max_len(1).enumerate().try_for_each(..)

or feed the items through a shared queue. Either way the results are unchanged; only the order in which harnesses start changes, and each harness's output is already reported in its own block. The abort latch keeps working, since every unit still checks it before running.

Activity

  1. added
    [C] Bug
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions