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

ClockSource::waitForConditionUntil calls wait_until with a mocked deadline

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.3
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • ALL
      • Get a windows-64-vs2019-nonprod spawnhost
      • Build and run dbtest or util_test
      • Watch the memory usage go crazy.
    • Service Arch 2020-01-27

      While undertaking some experiments with VS2019 (it cuts our build times in half), we found that several unit tests and the dbtests had very rapid memory leaks.

      Investigation has revealed ClockSource::waitForConditionUntil is passing a mocked deadline to a wait_until call on a system condition_variable that is using the system clock. Since the mocked values are very small, the wait is skipped. The erroneous line is here: https://github.com/mongodb/mongo/blob/b157e332ffe0963c8c503bb9ecb380fd158e0871/src/mongo/util/clock_source.cpp#L87

      The result is that we spin hard in https://github.com/mongodb/mongo/blob/b157e332ffe0963c8c503bb9ecb380fd158e0871/src/mongo/util/clock_source.h#L117-L120, and each iteration allocates a new AlarmInfo .
      One truly curious thing is why this only appears to be an issue on the VS2019 images, and doesn't seem to cause problems on the VS2017 builders.

            Assignee:
            ben.caimano@mongodb.com Benjamin Caimano (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: