-
Notifications
You must be signed in to change notification settings - Fork 478
Race condition during leader stepdown #168
Comments
Permanent link to those lines of code: https://github.com/goraft/raft/blob/0a20921dcb19e24e19794ce70a43bc9aadff3732/server.go#L904-920 |
@zenazn @mathiasbynens I think this is fixed by #167 |
@zenazn Yes. Go-raft needs some cleaning up work. |
@zenazn One more thing, how did you find out the problem? Are you trying to audit the codes against the raft paper? |
We discovered this bug in the process of writing the reference solution to Level 4 of Stripe's CTF (https://stripe-ctf.com). The network simulator I wrote for the event, Octopus (https://github.com/stripe-ctf/octopus), turns out to be very good at reproducing this particular bug :) The patch in #167 introduces a deadlock, which I'll comment on there. |
@zenazn CTF is interesting! I found this bug several days ago when I was doing a benchmark. |
getEntriesAfter
panics with the message"raft: Index is beyond end of log: 10 20"
In general, the locking around log operations is super sketchy. I suspect, for instance, that the entirety of https://github.com/goraft/raft/blob/master/server.go#L904-920 ought to be protected by a single lock acquisition / release, for instance.
The text was updated successfully, but these errors were encountered: