Deflake IntervalTimerTest tests that relied on old kernel behavior. #12205
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.
Deflake IntervalTimerTest tests that relied on old kernel behavior.
This commit fixes two flaky tests in the IntervalTimerTest suite that were
failing on newer Linux kernels (like Linux 6.6.65) due to changes in signal
handling logic. It passes on at least Linux 5.10.0.
RealTimeSignalsAreNotDuplicated: This test was failing because it assumed that
disarming a timer (calling timer_settime with a zero interval) would leave one
pending signal but reset the si_overrun count. On newer kernels, this action
appears to clear both the pending signal and the overrun count, causing the
initial sigtimedwait() to fail with EAGAIN. The relevant Linux commit seems to
be 513793bc6ab3 ("posix-timers: Make signal delivery consistent"). Fixed it by
calling sigtimedwait() before disarming the timer.
IgnoredSignalCountsAsOverrun: This test was also failing with EAGAIN. Its
logic was based on the premise that a blocked signal with a SIG_IGN disposition
would be queued, allowing sigtimedwait to retrieve it and check its overrun
count. This premise is no longer valid on modern kernels. It seems like newer
kernels now discard SIG_IGN immediately on generation, regardless of whether
the signal is blocked or not. The signal never becomes pending, so sigtimedwait
will always fail. The relevant Linux commit seems to be df7a996b4dab ("signal:
Queue ignored posixtimers on ignore list"). Just deleted this test.