-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: bson-4.2.1
-
Component/s: BSON
-
Labels:None
-
Environment:centos 7, ruby 2.4.1, mongoid 6.1 bson 4.2.1
Greetings,
There is an apparent "overwrite" regarding the mongoid id, that appears to be a race condition. This is present, when creating a mongoid document and then immediately asking for it's id, twice.
# create test document doc = TestDoc.new(stuff: 'hello world') # immediately grab "id" id_clone = doc.id.clone # must clone, otherwise ruby will point to the same object ids = doc.id.to_s if id_clone.to_s != ids puts "(id_clone) #{id_clone} != (doc.id.to_s) #{ids}" sleep 0.01 puts "(doc.id) #{doc.id} != (doc.id.to_s) #{doc.id.to_s}" # matches up now exit end
I attempted to trace down the race condition and ran into the native extension and got.. confused.
This bug is present in Mongoid 5.1.6 as well.
Thank you for your hard work!
-daniel