test(Thread): deflake testTrySleep and prevent SEGFAULT on failure #5316#5329
Merged
test(Thread): deflake testTrySleep and prevent SEGFAULT on failure #5316#5329
Conversation
- Poll the atomic counter with a 5 s budget instead of racing a 10 ms / 200 ms wait after wakeUp and natural trySleep expiry. - Wrap the body in try/catch to join the worker on assertion failure, turning a SEGFAULT into a clean FAILURE. - Replace the final unbounded join() with tryJoin(5000) so wakeUp regressions fail fast instead of hanging CI. The 100 ms wait proving the worker goes back to sleep between wakeUps is preserved -- a negative property requires a fixed-duration check.
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.
Summary
Fixes #5316 --
ThreadTest::testTrySleepintermittently failed on themacos-clang-cmake-poco-soo-offCI job, and the failure was followedby a SEGFAULT that aborted the whole
Foundation-testrunner.200 ms wait after
wakeUp()and naturaltrySleepexpiry.try/catchto join the worker on assertion failure,turning a SEGFAULT into a clean FAILURE.
join()withtryJoin(5000)sowakeUpregressions fail fast instead of hanging CI.
The 100 ms wait proving the worker goes back to sleep between wakeUps
is preserved -- a negative property requires a fixed-duration check.
Test plan
ThreadTest.testTrySleepstress run 50/50 passes on macOSThreadTestsuite passes (17/17)macos-clang-cmake-poco-soo-offjob green