[SERVER-34571] Invariant fails in destructor of MigrationChunkClonerSourceLegacy on shutdown Created: 19/Apr/18 Updated: 29/Oct/23 Resolved: 23/Apr/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.15, 3.6.5, 3.7.6 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Saltz (Inactive) | Assignee: | Matthew Saltz (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | ALL | ||||||||
| Backport Requested: |
v3.6, v3.4
|
||||||||
| Sprint: | Sharding 2018-05-07 | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 1 | ||||||||
| Description |
|
When we try to cleanup the MigrationSourceManager on error (cleanupOnError), we also clean up the MigrationChunkClonerSourceLegacy object (call cancelClone, which calls _cleanup), and then the MigrationChunkClonerSourceLegacy object is destructed. In the destructor, there's an invariant
_deleteNotifyExec is a unique_ptr to a PlanExecutor object. In theory, in _cleanup(), it should be reset and destructed - hence the invariant. However, if an exception is thrown in _cleanup before this happens, and then ~MigrationChunkClonerSourceLegacy gets called, the program will abort since we're throwing an exception while already throwing an exception, which is A Bad Thing™. In the case of BF-8673 this seems to be what happened, presumably due to one of the functions in _cleanup failing due to shutdown being in progress. We could potentially fix this by wrapping these functions in a try-catch, or instead of using _deleteNotifyExec.reset() we could just std::move(_deleteNotifyExec) into the local scope so that _deleteNotifyExec will indeed be empty no matter what, and this invariant won't fail. |
| Comments |
| Comment by Githook User [ 23/Apr/18 ] |
|
Author: {'email': 'matthew.saltz@mongodb.com', 'name': 'Matthew Saltz'}Message: (cherry picked from commit 179985c786cea234b65946ff647debfdfdbed511) |
| Comment by Githook User [ 23/Apr/18 ] |
|
Author: {'email': 'matthew.saltz@mongodb.com', 'name': 'Matthew Saltz'}Message: (cherry picked from commit 179985c786cea234b65946ff647debfdfdbed511) |
| Comment by Githook User [ 23/Apr/18 ] |
|
Author: {'email': 'matthew.saltz@mongodb.com', 'name': 'Matthew Saltz'}Message: |
| Comment by Matthew Saltz (Inactive) [ 20/Apr/18 ] |