Skip to content
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

Thread Safety #7

Open
xucito opened this issue Jun 2, 2019 · 1 comment
Open

Thread Safety #7

xucito opened this issue Jun 2, 2019 · 1 comment

Comments

@xucito
Copy link

xucito commented Jun 2, 2019

Don't know if you are still working on this, but I looked at your implementation and found some issues - just a FYI.

A lot of the operations in your implementation are not thread safe.

An example of this is, your heartbeats interval can exceed the time it takes to complete a heartbeat, as a result you can have two "AppendEntries" running concurrently, this causes issues particularly when both threads reach

toApply.ForEach(x => StateMachine.Apply(x.Command));

applying your logs twice.

You should have dedicated threads that loop this check and log application.

@guille
Copy link
Owner

guille commented Jun 4, 2019

Yep, it's definitely an issue. I don't really have the time to keep improving RaftCore but if anyone wants to take a stab at it I'll review and merge the PR.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants