[SERVER-45593] ClockSource::waitForConditionUntil calls wait_until with a mocked deadline Created: 15/Jan/20  Updated: 29/Oct/23  Resolved: 21/Jan/20

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.3.3

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Benjamin Caimano (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-45238 Some unit tests have massive memory l... Closed
Duplicate
is duplicated by SERVER-45238 Some unit tests have massive memory l... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:
  • Get a windows-64-vs2019-nonprod spawnhost
  • Build and run dbtest or util_test
  • Watch the memory usage go crazy.
Sprint: Service Arch 2020-01-27
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 21/Jan/20 ]

Author:

{'username': 'bcaimano', 'name': 'Ben Caimano', 'email': 'ben.caimano@mongodb.com'}

Message: SERVER-45593 Use SystemClockSource for mock path waitForConditionUntil()
Branch: master
https://github.com/mongodb/mongo/commit/685afc7262c35f71cc04ceb0819a3a90f06c95bb

Generated at Thu Feb 08 05:09:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.