You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for the library! We were trying out raft v1.7.0, and found that the pre-vote implementation has a bug where a follower rejects the pre-vote req from node X even when when the follower thinks that X is the leader.
// Check if we have an existing leader [who's not the candidate] and alsovarcandidateServerAddress// ISSUE: this is not set at allcandidateID:=ServerID(req.ID)
// if the Servers list is empty that mean the cluster is very likely trying to bootstrap,// Grant the voteiflen(r.configurations.latest.Servers) >0&&!inConfiguration(r.configurations.latest, candidateID) {
r.logger.Warn("rejecting pre-vote request since node is not in configuration",
"from", candidate)
return
}
ifleaderAddr, leaderID:=r.LeaderWithID(); leaderAddr!=""&&leaderAddr!=candidate { // ISSUE: so this will always return true as long as the follower has a leaderr.logger.Warn("rejecting pre-vote request since we have a leader",
"from", candidate,
"leader", leaderAddr,
"leader-id", string(leaderID))
return
}
The text was updated successfully, but these errors were encountered:
@k-jingyang great catch and thanks for reporting this and creating a PR.
I'm curious how you found this case. Did you observe this bug in a production or test settting? Or was this something you spotted in the code?
I agree we should probably fix that code as it's at least not doing what was intended, just trying to understand the scenarios where it would have an impact.
Hello, thanks for the library! We were trying out raft v1.7.0, and found that the pre-vote implementation has a bug where a follower rejects the pre-vote req from node X even when when the follower thinks that X is the leader.
This is the offending line. https://github.com/hashicorp/raft/blob/main/raft.go#L1752
The text was updated successfully, but these errors were encountered: