Discovered incidentally while hammering cargo test --all --features subprocess -- --test-threads=64 under heavy host load (load average ~50-130 on a 32-core box, from concurrent unrelated builds) trying to reproduce #135.
kernel::tests::test_cancel_interrupts_for_loop (unit test in crates/kaish-kernel/src/kernel.rs) asserts that a cancelled for loop exits with code 130:
thread 'kernel::tests::test_cancel_interrupts_for_loop' (963523) panicked at crates/kaish-kernel/src/kernel.rs:7514:9:
assertion `left == right` failed: cancelled execution should exit with code 130
left: 0
right: 130
left: 0 means the loop ran to completion (exit 0) instead of being interrupted (130) — under heavy CPU contention the cancellation signal/check apparently doesn't land before the loop body finishes, so the race between "issue cancel" and "loop completes on its own" tips the wrong way when scheduling is starved. Not otherwise investigated further (didn't look at the test's exact timing setup, e.g. whether it races a fixed sleep against a spawned cancel) — this was collateral evidence from #135's reproduction attempt, not the focus of that investigation. Worth a look at whatever timing assumption underlies the test to give it real margin under load, similar in spirit to #148.
Discovered incidentally while hammering
cargo test --all --features subprocess -- --test-threads=64under heavy host load (load average ~50-130 on a 32-core box, from concurrent unrelated builds) trying to reproduce #135.kernel::tests::test_cancel_interrupts_for_loop(unit test incrates/kaish-kernel/src/kernel.rs) asserts that a cancelledforloop exits with code 130:left: 0means the loop ran to completion (exit 0) instead of being interrupted (130) — under heavy CPU contention the cancellation signal/check apparently doesn't land before the loop body finishes, so the race between "issue cancel" and "loop completes on its own" tips the wrong way when scheduling is starved. Not otherwise investigated further (didn't look at the test's exact timing setup, e.g. whether it races a fixed sleep against a spawned cancel) — this was collateral evidence from #135's reproduction attempt, not the focus of that investigation. Worth a look at whatever timing assumption underlies the test to give it real margin under load, similar in spirit to #148.