-
Notifications
You must be signed in to change notification settings - Fork 939
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
protocols/kad: debug_assert panic - expecting disconnected peer not to be connected #2092
Comments
I'm currently working on a personal project and this one pops quit often for me. I'm a bit new to libp2p in general, why is that |
🎉 Thanks for following up here @FelipeRosa.
It is supposed to uphold that there is no state mismatch between routing table and connected peers tracked in the Kademlia I haven't gotten around to further debugging this. In case you are able to reproduce this reliably, could you share a minimal reproducible example here @FelipeRosa? |
Hey @mxinden, Thanks for the quick reply.
I'm not able to reproduce this issue consistently. I read a bit of the libp2p_kad code to try to understand where this might be coming from but I didn't quite wrap my head around it yet. What I did try to do is create a little program to keep generating hashes that would fall into buckets with available space in them and then making Something like this but with some code to wait for queries to finish: let rand_bytes: [u8; 32] = rng.gen();
let ma = libp2p::multihash::Sha2_256::digest(&rand_bytes).as_ref().to_vec();
if let Some(bucket) = swarm.behaviour_mut().kbucket(ma.clone()) {
if !bucket.has_pending() {
swarm.behaviour_mut().get_closest_peers(ma);
}
} My guess is that by doing this I would keep having peers connecting and disconnecting to generate as many routing table states as possible in order to reach the one which causes this bug. Do you have any suggestions for things I could try? |
I also experienced this bug during my recent experiments with libp2p, but could not reliably reproduce it. |
I triggered the panic below with https://github.com/mxinden/rust-libp2p-server/. Unable to reproduce thus far.
rust-libp2p/protocols/kad/src/behaviour.rs
Lines 1024 to 1025 in 3b0f5a4
Is the
debug_assert
to strict?The text was updated successfully, but these errors were encountered: