[SERVER-72478] Construct uuidGen on first use to avoid static init order fiasco Created: 03/Jan/23  Updated: 29/Oct/23  Resolved: 04/Jan/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Daniel Gomez Ferro Assignee: Daniel Gomez Ferro
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-01-09
Participants:

 Description   

uuidGen is a static object in uuid.cpp . When working on a test I created a static DatabaseVersion with DatabaseVersion::makeFixed() that internally depends on uuidGen. This worked on some build variants but failed in others, this problem is called the static initialization order fiasco.

We can use the construct on first use idiom to avoid this problem.



 Comments   
Comment by Githook User [ 04/Jan/23 ]

Author:

{'name': 'Daniel Gómez Ferro', 'email': 'daniel.gomezferro@mongodb.com', 'username': 'dgomezferro'}

Message: SERVER-72478 Construct uuidGen on first use
Branch: master
https://github.com/mongodb/mongo/commit/e4ac90ab56a29bcd5a92050bfa32f081399a7059

Generated at Thu Feb 08 06:21:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.