Hoverbear / old-raft-rs

[Incomplete] A Raft implementation in Rust
https://hoverbear.github.io/raft-rs/raft/
MIT License
266 stars 41 forks source link

If reregistering a connection fails, the debug message lies #39

Closed WildCryptoFox closed 9 years ago

WildCryptoFox commented 9 years ago

In the event that connection.reregister fails, the error message informs that reading had failed when this isn't the case.

https://github.com/james-darkfox/raft/blob/d479b3b80c2e635a14f0af651684731295832d28/src/server.rs#L353-L362

This may just be a matter of wording - but will lack verbosity. Example:

https://github.com/james-darkfox/raft/blob/d479b3b80c2e635a14f0af651684731295832d28/src/server.rs#L343-L351

This line has it's own issue - namely we have already registered the connection into the slab, but it is no longer valid. Memory leak as noticed by dcb which has the same cause as https://github.com/danburkert/raft/commit/cdf36c91e22a8ed3ca223a7fde24f79456d27a13

As with the need for improved logging ( #38 ), we also need improved error handling - especially with the often too common usage of result.and_then.and_then.and_then.