Skip to content

Comments

PSMDB-1960 Fix flaky TimeoutSetAndGetAreConsistent test#1693

Merged
igorsol merged 1 commit intomasterfrom
psmdb-1960
Feb 20, 2026
Merged

PSMDB-1960 Fix flaky TimeoutSetAndGetAreConsistent test#1693
igorsol merged 1 commit intomasterfrom
psmdb-1960

Conversation

@igorsol
Copy link

@igorsol igorsol commented Feb 19, 2026

On Linux kernels prior to 5.1, SO_RCVTIMEO/SO_SNDTIMEO are stored internally as jiffies using ceiling division. The previous test value of 42ms is not exactly representable in jiffies for HZ=250 (rounds to 44ms) or HZ=100 (rounds to 50ms), causing the ASSERT_EQ to fail on machines with those kernel configurations. Changed to 100ms, which is an exact multiple of 20ms (the LCM of jiffy sizes for HZ=100, 250, and 1000), ensuring the set/get round-trip is exact on all common kernel HZ values.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates an Asio socket timeout round-trip unit test to avoid Linux-kernel-dependent rounding behavior (pre-5.1 jiffies-based storage) that was making the test flaky across common HZ configurations.

Changes:

  • Adjust TimeoutSetAndGetAreConsistent to use a timeout value that round-trips exactly across common Linux HZ values.
  • Add inline documentation explaining the kernel/jiffies rounding behavior and rationale for the chosen duration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

timeoutOptionTest([](auto& socket, auto option, const char* name) {
using Option = decltype(option);
const auto duration = std::chrono::milliseconds(42);
// Use a duration that is an exact multiple of 20ms (the LCM of jiffie sizes for
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the comment: the correct term is “jiffy” (singular) / “jiffies” (plural), not “jiffie”.

Suggested change
// Use a duration that is an exact multiple of 20ms (the LCM of jiffie sizes for
// Use a duration that is an exact multiple of 20ms (the LCM of jiffy sizes for

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

On Linux kernels prior to 5.1, SO_RCVTIMEO/SO_SNDTIMEO are stored
internally as jiffies using ceiling division. The previous test value
of 42ms is not exactly representable in jiffies for HZ=250 (rounds to
44ms) or HZ=100 (rounds to 50ms), causing the ASSERT_EQ to fail on
machines with those kernel configurations. Changed to 100ms, which is
an exact multiple of 20ms (the LCM of jiffy sizes for HZ=100, 250,
and 1000), ensuring the set/get round-trip is exact on all common
kernel HZ values.
@igorsol igorsol merged commit d0dda67 into master Feb 20, 2026
5 checks passed
@igorsol igorsol deleted the psmdb-1960 branch February 20, 2026 11:28
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.

3 participants