-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Cluster Scalability
-
Fully Compatible
-
ALL
-
ClusterScalability 8Jun-22June, ClusterScalability 22Jun-6Jul
-
None
-
None
-
None
-
None
-
None
-
None
-
None
From a PR comment.
In ReshardingRecipientService, _changeStreamsMonitorStarted SharedPromise is fulfilled 4 times, three of those times under exclusive lock. But in _createAndStartChangeStreamsMonitor, the promise is fulfilled without holding an exclusive lock.
Code snippet:
if (!_metadata.getPerformVerification() || _skipCloningAndApplying ||
inPotentialAbortScenario(_recipientCtx.getState()) ||
_changeStreamsMonitorStarted.getFuture().isReady() ||
_changeStreamsMonitorCompleted.getFuture().isReady()) {
return;
}
_createChangeStreamsMonitor(executor, factory);
_changeStreamsMonitorStarted.emplaceValue();
The check of isReady will catch most cases of double fulfillment, but there is a window here where isReady returns false, but then the SharedPromise is fulfilled before emplaceValue is called. This would cause a exception, as a SharedPromise can only be fulfilled once.
The fix is to put the isReady/emplaceValue sequence under an exclusive lock.
- is related to
-
SERVER-128393 Standardize SharedPromise usage and add Coverity suppression
-
- Closed
-