[SERVER-29382] Fix cancel race related to the timeout in ReplicationCoordinatorImpl::CatchupState Created: 26/May/17 Updated: 30/Oct/23 Resolved: 12/Jun/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.6, 3.5.9 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Matthew Russotto | Assignee: | Siyuan Zhou |
| 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.4
|
||||||||
| Sprint: | Repl 2017-06-19 | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 0 | ||||||||
| Description |
|
If we call ReplicationCoordinatorImpl::CatchupState::abort_inlock() at a time when the cancel callback lambda is in progress, we may delete the CatchupState out from under the cancel callback. We can fix this by 2) Check callback cancellation only after acquiring the mutex. This allows a late cancel to work, provided it's done while the lock is held, which is always true because CatchupState is required to be accessed only under lock. |
| Comments |
| Comment by Githook User [ 16/Jun/17 ] | ||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: (cherry picked from commit a66d41d71a4b7215ad6ba37adc392352da6ec477) | ||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 12/Jun/17 ] | ||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}Message: | ||||||||||||||||||||||||||||||||||||
| Comment by Benety Goh [ 26/May/17 ] | ||||||||||||||||||||||||||||||||||||
|
It's probably a bad idea to let CatchUpState delete itself, especially when it does not wait for the canceled callback to complete.
| ||||||||||||||||||||||||||||||||||||