[CDRIVER-2923] bson_oid_init returns same oid after fork() Created: 11/Jan/19  Updated: 28/Oct/23  Resolved: 31/Jan/19

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.14.0

Type: Bug Priority: Blocker - P1
Reporter: Henrik Edin Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
is caused by CDRIVER-2771 Implement ObjectID spec Closed
Related
Backwards Compatibility: Minor Change

 Description   

An application that calls fork() in a loop and then the forked processes call bson_oid_init() will end up with the same oid if called within the same second because the implementation of bson_oid_init() uses a cached per-process random even if BSON_CONTEXT_DISABLE_PID_CACHE is set.

Introduced by:
https://github.com/mongodb/mongo-c-driver/commit/8130e791c2a101a38fe5551c253c7b0dda894d3a



 Comments   
Comment by Githook User [ 31/Jan/19 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-2923 fix test string
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6469ce0656be5e798964b00693a7e4958271afdb

Comment by Githook User [ 15/Jan/19 ]

Author:

{'username': 'kevinAlbs', 'email': 'kevin.albertson@mongodb.com', 'name': 'Kevin Albertson'}

Message: CDRIVER-2923 fix scan build
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/cb4bba6c29882ba3511c66df816b940b6af664fd

Comment by Githook User [ 15/Jan/19 ]

Author:

{'username': 'kevinAlbs', 'email': 'kevin.albertson@mongodb.com', 'name': 'Kevin Albertson'}

Message: CDRIVER-2923 remove unused variable
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6819602432e98a70c6b5c13af9fba4c8c3ce8ae1

Comment by Githook User [ 15/Jan/19 ]

Author:

{'username': 'kevinAlbs', 'email': 'kevin.albertson@mongodb.com', 'name': 'Kevin Albertson'}

Message: CDRIVER-2923 check pid in oid generation

The random five bytes in oid generation should be machine and
process unique, and should (by default) change if the process id
changes.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/35a642d2e21d890be54457868810e55532da6624

Generated at Wed Feb 07 21:16:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.