PsiACE / riteraft

RiteRaft - A raft framework, for regular people
Apache License 2.0
320 stars 22 forks source link

Fix abnormal panicking due to missing if statement #21

Closed jopemachine closed 1 year ago

jopemachine commented 1 year ago

Hello, I'm currently working on writing Python bindings of this crate (although it's not working yet)

I noticed that the example code was not functioning in the riteraft dev branch, so I added an if statement that seemed to be missing by mistake.

I mistakenly thought that the issue was caused by updating tokio, as the program was quietly panicked without any warning messages at first. But, it appears that this issue is not related to the tokio update. The bug occurs when the context of the first entry is an empty slice, which cannot be deserialized to the u64.

You can check that the program panicked at that line by replacing that line's ? with unwrap.

https://github.com/ritelabs/riteraft/blob/dev/src/raft_node.rs#L495

I have checked that the example code in the dev branch is working properly with raft-rs 0.7.0

jopemachine commented 1 year ago

I apologize for the confusion. It seems that this patch is not functioning properly with raft-rs 0.7.0. The patch was tested with not updated Cargo.toml.. But anyway it appears that there is still a missing conditional statement that needs to be added. Due to the inclusion of a mistake in this PR, I will close it for now.