Comments (7)
If I leave them as zero (there are no log entries at this stage committed or otherwise as it's a fresh start), it core dumps with:
raftxmpp: src/raft_log.c:97: log_get_from_idx: Assertion `0 <= idx - 1' failed.
from raft.
Hi Pete
You don't need to populate those two fields. Those fields are populated by the raft_recv_appendentries function
I'll have a look, but I don't think the raft library will result in an operation that results in that assertion firing. It might be caused by the way you're interfacing with the library (this happened to me, when my deserializer wasn't populating the msg_appendentries_response_t fields correctly!)
from raft.
Also just got this after a period of time running:
raftxmpp: src/raft_server.c:183: raft_recv_appendentries_response: Assertion `0 <= raft_node_get_next_idx(p)' failed.
Aborted (core dumped)
Perfectly willing to believe it's something I'm doing :)
However this is what I'm putting in:
msg_appendentries_response_t *res = calloc(1,sizeof(msg_appendentries_response_t));
res->success = success; // either 1 or 0 - but the cluster doens't send data so always 1
res->term = term; // Doesn't change often - but in small digits - doesn't die right away
raft_recv_appendentries_response(data->raft_server, other_node, res);
Basically, the whole thing is initialized to zero and if I don't set something in those other fields, it is guaranteed to fail that assert....
from raft.
I've created a unit test for it here:
https://gist.github.com/pmembrey/f581e503ae303c06098a
Hopefully this will make it obvious what I'm doing wrong :)
I'm running this on Ubuntu...
from raft.
For the second issue I mentioned, I think it's being caused by a race condition. I'm going to try and replicate it tonight in a unit test. What seems to happen is this:
- Node A is leader and sends out append entries to Node B
- Node A receives append entries from Node B with higher term
- Node A becomes a follower
- Node A receives an append entries reply
- Assert fails
Here's the assert again:
raftxmpp: src/raft_server.c:183: raft_recv_appendentries_response: Assertion `0 <= raft_node_get_next_idx(p)' failed.
from raft.
Re: the raft_recv_appendentries_response issue, you should never hand populate the fields. You should use raft_recv_appendentries for this. That's why it's failing in your unit test. This is how to populate it:
msg_appendentries_response_t res;
int e = raft_recv_appendentries(sv->raft, conn->node_idx, &ae, &res);
I will release the example app tonight, so that should help explain things :)
Re: the 2nd issue, that looks interesting, I will have a look at that.
from raft.
Re: the `0 <= raft_node_get_next_idx(p)' bug. I was able to reproduce this on ticketd. I've made the fix here: f297457
Can you please check if you're still experiencing the issue?
Cheers
from raft.
Related Issues (20)
- Possible issues HOT 1
- How to add SOVERSION to libraft.so?
- Not implemented log_clear callback leads to not synchronized logs
- reserved identifier violation
- Unused raft_term_t term in log_load_from_snapshot
- potential race condition in removing/adding same node?
- Should we submit empty log after a new leader elected?
- Allow easy build without coverage symbols and AddressSanitizer
- Errors `undefined reference to raft_new()` and `undefined reference to raft_add_node(void**, void*, int, int)` HOT 1
- leader election without log involved? HOT 8
- disk write and leader timeout HOT 4
- Documents are old HOT 5
- Add PreVote support
- raft_send_appendentries_all logic HOT 1
- Log interface decoupling HOT 5
- Empty AppendEntries requests are sent during non-idle periods
- FSM log entries are applied lazily HOT 1
- Leader goes into infinite send_snapshot loop HOT 4
- Meaning of entry_idx in log_offer
- log_get_from_idx not including entries that have wrapped around? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raft.