Repository navigation
test: make Waiter futex timed wait test robust on slow CI runners - #591
Conversation
The 200ms upper bound tripped on a macOS CI runner that took 221ms to reschedule the thread after a 50ms wait. The bound only exists to catch gross timeout miscalculation (wrong units, waiting forever), so relax it to 5s, and print the measured elapsed time on failure so future trips are diagnosable from the CI log.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe futex-based ChangesTimed wait test
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
common.test.Waiter: futex-based timed wait with timeoutfailed on macOS CI withTestUnexpectedResultafter 221ms. The test does a 50ms futex timed wait and asserts elapsed < 200ms as a sanity check. The Darwin implementation is correct (__ulock_waitgets the timeout in microseconds, mapsTIMEDOUT, and the retry loop recomputes the remaining time from the deadline), so the wait fired on time; the thread just wasn't rescheduled for ~170ms afterwards, which is routine on oversubscribed macOS runners. The test predates the recent fs changes and the failure is unrelated to them.Fix
The upper bound only exists to catch gross timeout miscalculation (wrong units, waiting forever, the realtime-vs-monotonic confusion mentioned in
futexTimeout). A 5s bound catches that entire class just as reliably while being immune to scheduler noise; the meaningful assertion is the 40ms lower bound, which is unchanged. Also print the measured elapsed time on failure, so a future trip is diagnosable straight from the CI log.