Keep the parallel rounds running until the reader has called - #25
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the flaky
calls_from_another_thread_are_safe_during_setup_and_teardownon 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