akka-raft icon indicating copy to clipboard operation
akka-raft copied to clipboard

Candidate does not distinguish between votes from same follower

Open schuster opened this issue 9 years ago • 2 comments

The Candidate state does not distinguish between multiple votes in the same term from the same follower, although it should. Otherwise, a candidate might get elected by the same follower (this will only happen if bug #29 is fixed as well to allow multiple votes from same follower).

schuster avatar Apr 15 '15 16:04 schuster

Update: this issue does not depend on #29 being fixed. I was able to trigger it as follows:

  • Candidate starts election in Term(1), sends RequestVote message to all peers
  • Follower receives RequestVote, responds with VoteCandidate
  • Candidate receives ElectionTimeout [before receiving VoteCandidate], increments its Term, sends RequestVote message to all peers.
  • Same follower receives RequestVote, responds with VoteCandidate
  • Now Candidate may receive two VoteCandidates from the same Follower.

Combined with #46 , this means that it's possible for two leaders to be elected in the same Term.

colin-scott avatar Aug 02 '15 00:08 colin-scott

For what it's worth, I have a (non-pull-request-worthy) fix for this issue here:

https://github.com/NetSys/sts2-applications/commit/5130f1f51a931a86687c8bf80f014e2dfc9e2bbd

colin-scott avatar Aug 08 '15 02:08 colin-scott