Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-58618

Sleep intervals in interruptible_test cause imprecision

    • Fully Compatible
    • ALL
    • v5.0
    • Service Arch 2021-08-09
    • 33
    • 1

      waitForConditionOrInterruptUntil relies on our defined waitForConditionOrInterruptNoAssertUntil, which sleeps for kPrecision milliseconds before waking to check deadline in a loop. The comment suggests that kPrecision is to deal with inaccuracies, but is used in waitForConditionOrInterruptNoAssertUntil as an interval between sleeps. Then the problem would be that if Date_t::now() == 3:59.99 and deadline == 4:00.00 for example, the next iteration of the loop would be no earlier than Date_t::now() == 4:00.04. Therefore, the time needed for scheduling and timing inaccuracies could cause the end time to be greater than the deadline time. Suggested changes: use sleepFor function instead of a loop + sleep intervals.

            Assignee:
            alex.li@mongodb.com Alex Li
            Reporter:
            alex.li@mongodb.com Alex Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: