Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
None
-
Fully Compatible
-
ALL
-
Execution Team 2020-12-14
-
16
Description
When UncommittedCollections commit a collection we install the new collection in the catalog here: https://github.com/mongodb/mongo/blob/1e6d0a856a9c9858552cdbdec889be14f4964b61/src/mongo/db/catalog/uncommitted_collections.cpp#L150-L151
And later we set the committed flag in a commit handler: https://github.com/mongodb/mongo/blob/1e6d0a856a9c9858552cdbdec889be14f4964b61/src/mongo/db/catalog/uncommitted_collections.cpp#L161
While still holding on to the MODE_IX lock.
However, a lock-free reader may access this collection instance on a different thread and check CollectionImpl::_committed, causing a data race as this is not an atomic variable.