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

null pointer dereference on raft_periodic #44

Open
skorokhod opened this issue Jun 28, 2017 · 2 comments
Open

null pointer dereference on raft_periodic #44

skorokhod opened this issue Jun 28, 2017 · 2 comments

Comments

@skorokhod
Copy link

call of raft_periodic with the only non-self node added causes the library to crash there:

    if (1 == raft_get_num_voting_nodes(me_) &&
        raft_node_is_voting(raft_get_my_node((void*)me)) &&
        !raft_is_leader(me_))
        raft_become_leader(me_);

because raft_get_my_node return null.
null pointer check should be added.

@skorokhod
Copy link
Author

and the same kind of issue is in raft_periodic there:

        if (1 < raft_get_num_voting_nodes(me_) && raft_node_is_voting(raft_get_my_node(me_)))
            raft_election_start(me_);

but I'm not sure whether we need to start election there or not in this case

@willemt
Copy link
Owner

willemt commented Jan 9, 2018

Sorry for not getting back to this for a long time.

When this happens it indicates that you didn't do raft_add_node with is_self = 1 for the self node. I am considering adding an if statement check that will return -1 in this situation.

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