[SERVER-70357] mongobridge data race generating random seeds Created: 07/Oct/22  Updated: 29/Oct/23  Resolved: 08/Oct/22

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

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-10-17
Participants:
Linked BF Score: 160

 Description   

A pseudorandom number generator is accessed from multiple threads in mongobridge

Possible fix:

     PseudoRandom makeSeededPRNG() {
         static StaticImmortal g = PseudoRandom{mongoBridgeGlobalParams.seed};
+        static Mutex m;
+        stdx::lock_guard lk{m};
         return PseudoRandom{g->nextInt64()};
    }

Caused the BF-26584 TSAN alert.



 Comments   
Comment by Githook User [ 08/Oct/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-70357 fix data race generating mongobridge random number seed
Branch: master
https://github.com/mongodb/mongo/commit/115d950b815b54e4a91716a5877631e7174022ac

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