-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.11, 4.0.7, 4.1.6
-
Component/s: Replication
-
ALL
-
v4.0, v3.6, v3.4
-
Repl 2018-10-22, Repl 2018-11-05, Repl 2019-01-14
-
52
If a replSetReconfig runs on a node that is concurrently processing a successful election win, it is possible to trigger this invariant. The ReplicationCoordinatorImpl::_onVoteRequestComplete method is called when the VoteRequester completes. In the case of a successful election, we will print this message, and then proceed to processing the election win. We will reset the VoteRequester and then update our member state to reflect our transition to leader. Before we call _performPostMemberStateUpdateAction, though, we unlock the ReplicationCoordinator mutex. This allows a concurrent reconfig command, currently running ReplicationCoordinatorImpl::_finishReplSetReconfig, to end up cancelling an election before we have transitioned to Leader mode. We call ReplicationCoordinatorImpl::_cancelElectionIfNeeded_inlock when the _voteRequester has been reset, but while we are still in the Candidate role. So, we will not return early here, and will end up hitting the subsequent invariant, since the VoteRequester was already destroyed.