[SERVER-71544] Race condition on _sessionCatalogSource in LogOpShardingHandler::commit Created: 22/Nov/22  Updated: 29/Oct/23  Resolved: 29/Nov/22

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

Type: Improvement Priority: Major - P3
Reporter: Wenqin Ye Assignee: Wenqin Ye
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

The LogOpShardingHandler::commit method checks if the _sessionCatalogSource
 member from the `MigrationChunkClonerSourceLegacy` class is constructed, but that member may be in the process of being constructed (via the MigrationChunkClonerSourceLegacy::startClone method). This is a race condition because the check may succeed because the memory address for _sessionCatalogSource has some data written, but not all of the data may have been finished being written, so using it would be unsafe.

Note that other methods in MigrationChunkClonerSource that do a similar check for if the sessionCatalgSource exists are not racy because they are assumed to be running after startClone is ran (which is the only method that constructs the _sessionCatalogSource).

 



 Comments   
Comment by Githook User [ 28/Nov/22 ]

Author:

{'name': 'wenqinYe', 'email': 'wenqin908@gmail.com', 'username': 'wenqinYe'}

Message: SERVER-71544 Fix race condition on _sessionCatalogSource in LogOpShardingHandler::commit
Branch: master
https://github.com/mongodb/mongo/commit/ee8a38cc92b5ff1e39ff2e702a17e25d29280409

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