-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Killing the leader of a cluster generates excessive network attempts for replicating log entries #1051
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
I can not download the log file you attached, which gave me a 404 error. :( But I guess what happened with your application is this problem:
|
Hey @drmingdrmer, thanks for looking into this and sending over that link. That is what seems to be happening. After updating the raft_network_impl.rs file to check if it was a connection related error and return Unreachable instead it behaves as expected. let resp = client
.post(url)
.json(&req)
.send()
.await
.map_err(|e| {
if e.is_connect() {
return openraft::error::RPCError::Unreachable(Unreachable::new(&e));
}
openraft::error::RPCError::Network(NetworkError::new(&e))
})?; Any concerns if I add this change to the example in the repo along w/ a comment on why? I feel it may add benefit to others if they encounter the same issue. |
Absolutely, let's polish it up! It gonna be an excellent job sharpening the example to fit perfectly into this case! |
Describe the bug
When the leader of a cluster with multiple members is killed, a new follower is promoted to leader. The new leader then tries to replicate log entries repeatedly with no delay to the old leader which is no longer running.
All logs, screenshots, etc. are with log level set to warn to highlight the problem areas, frequency of issues.
To Reproduce
Steps to reproduce the behavior:
cd examples/raft-kv-memstore
To mitigate this I can apply the following diff to wait until the next tick vs. immediately trying again. I'm not certain the impact this has on the overall code though:
Expected behavior
I'd expect it to retry once every tick or with an exponential backoff if this occurred, not trying immediately.
Actual behavior
Generates requests continuously:
Env (please complete the following information):
Additional files:
LogsAndLock.zip
Additional context
I'm new to working with raft so may just be missing something here. Noticed this when working with my own project and had similar issues.
The text was updated successfully, but these errors were encountered: