[SERVER-62432] Ensure safe access to ShardingDDLCoordinator instance state documents Created: 07/Jan/22 Updated: 29/Oct/23 Resolved: 12/May/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | 5.0.0, 5.2.0, 5.1.0 |
| Fix Version/s: | 5.0.10, 6.0.0-rc9, 6.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jordi Serra Torrens | Assignee: | Enrico Golfieri |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sharding-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||
| Backport Requested: |
v6.0, v5.0
|
||||||||||||||||||||||||||||
| Sprint: | Sharding EMEA 2022-02-07, Sharding EMEA 2022-02-21, Sharding EMEA 2022-04-18, Sharding EMEA 2022-05-02, Sharding EMEA 2022-05-16 | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Linked BF Score: | 15 | ||||||||||||||||||||||||||||
| Description |
|
Instances of ShardingDDLCoordinators maintain an in-memory copy of their state document (e.g). The coordinator's main thread reads and writes it (e.g.). Also, other threads also read it without proper syncronization (e.g. checkIfOptionsConflict, reportForCurrentOp). This can lead to data races. This same pattern is repeated on all ShardingDDLCoordinators. To solve it we could synchronize access to the in-memory state with a mutex, similarly to what was done on |
| Comments |
| Comment by Githook User [ 02/Jun/22 ] |
|
Author: {'name': 'Enrico Golfieri', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}Message: (cherry picked from commit c4522f8d57ded742ff66a303fb264f517c06502a) |
| Comment by Githook User [ 30/May/22 ] |
|
Author: {'name': 'Enrico Golfieri', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}Message: |
| Comment by Githook User [ 10/May/22 ] |
|
Author: {'name': 'Enrico Golfieri', 'email': 'enrico.golfieri@mongodb.com', 'username': 'enricogolfieri'}Message: |
| Comment by Max Hirschhorn [ 13/Apr/22 ] |
|
Small note that RefineCollectionShardKeyCoordinator having this same issue came up in |
| Comment by Pierlauro Sciarelli [ 21/Mar/22 ] |
|
The same erroneous pattern is also implemented for rename participants. |
| Comment by Cris Insignares Cuello [ 20/Jan/22 ] |
|
jordi.serra-torrens can you take a look at this and fix the known cases. |