Skip to content

test(Thread): deflake testTrySleep and prevent SEGFAULT on failure #5316#5329

Merged
matejk merged 1 commit intomainfrom
5316-testTrySleep-poll-counter
Apr 21, 2026
Merged

test(Thread): deflake testTrySleep and prevent SEGFAULT on failure #5316#5329
matejk merged 1 commit intomainfrom
5316-testTrySleep-poll-counter

Conversation

@matejk
Copy link
Copy Markdown
Contributor

@matejk matejk commented Apr 20, 2026

Summary

Fixes #5316 -- ThreadTest::testTrySleep intermittently failed on the
macos-clang-cmake-poco-soo-off CI job, and the failure was followed
by a SEGFAULT that aborted the whole Foundation-testrunner.

  • 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.

Test plan

  • ThreadTest.testTrySleep stress run 50/50 passes on macOS
  • Full ThreadTest suite passes (17/17)
  • CI macos-clang-cmake-poco-soo-off job green
  • Linux CI still green



- 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.
@matejk matejk merged commit 5a94232 into main Apr 21, 2026
52 checks passed
@matejk matejk deleted the 5316-testTrySleep-poll-counter branch April 21, 2026 16:54
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.

ThreadTest::testTrySleep flaky on macOS, causes segfault

1 participant