Skip to content

Keep the parallel rounds running until the reader has called - #25

Merged
tanglearncode merged 1 commit into
mainfrom
fix/parallel-reader-overlap
Sep 14, 2026
Merged

tanglearncode merged 1 commit into
mainfrom
fix/parallel-reader-overlap

Conversation

@tanglearncode

@tanglearncode tanglearncode commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Fixes the flaky calls_from_another_thread_are_safe_during_setup_and_teardown on macOS.

Root cause: on macOS the 200 local mock rounds take about 2 ms, but starting the reader thread sometimes took up to 4 ms, so the stop flag was set before the reader's first call. The delay also happens with no mocking, and 2000 mocked rounds never delayed the reader, so it is not a library bug. Diagnostic run

The test now keeps running rounds until the reader has called the function while mocks were installed, with a limit so a reader that never runs still fails.

With the fix, the test passed 200 normal and 120 coverage runs in a row on macOS ARM64. Stress run

calls_from_another_thread_are_safe_during_setup_and_teardown failed once on
aarch64-apple-darwin at reader.join().unwrap() > 0: the reader thread made no
calls. A diagnostic run found no library cause. The reader takes no lock that
the rounds hold, and 2000 mocked rounds never delayed it. On macOS the 200
local rounds take about 2 ms, while starting the reader took up to 4 ms, also
with no mocking in the loop, so the stop flag was sometimes set first. It
reproduced once in 40 coverage runs there.

The test now keeps installing and restoring until the reader has called the
function during the rounds, with a limit so a reader that never runs still
fails.
@tanglearncode
tanglearncode merged commit 1e54924 into main Sep 14, 2026
12 checks passed
@tanglearncode
tanglearncode deleted the fix/parallel-reader-overlap branch September 14, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant