[SERVER-53142] Data race on CollectionImpl::_committed Created: 01/Dec/20  Updated: 29/Oct/23  Resolved: 10/Dec/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
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: Execution Team 2020-12-14
Participants:
Linked BF Score: 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.



 Comments   
Comment by Githook User [ 10/Dec/20 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-53142 Fix data race on CollectionImpl::_committed
Branch: master
https://github.com/mongodb/mongo/commit/69dcf82701251481ae5000b72a36b61f90b04544

Generated at Thu Feb 08 05:30:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.