-
Notifications
You must be signed in to change notification settings - Fork 42
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
Peer randomly disconnects when new peers join #1442
Comments
Tested with |
FYI, I tested this with libp2p directly without waku and I'm still seeing issues, but, only in some situations: import { noise } from "@chainsafe/libp2p-noise";
import { yamux } from "@chainsafe/libp2p-yamux";
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
import { mplex } from "@libp2p/mplex";
import { tcp } from "@libp2p/tcp";
import { createLibp2p } from "libp2p";
import { identifyService } from "libp2p/identify";
import { bootstrap } from "@libp2p/bootstrap";
const bootstrappers = [
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
];
const createNode = async (i) => {
const node = await createLibp2p({
addresses: {
listen: ["/ip4/0.0.0.0/tcp/0"],
},
transports: [tcp()],
streamMuxers: [yamux(), mplex()],
connectionEncryption: [noise()],
services: {
pubsub: gossipsub(),
identify: identifyService(),
},
peerDiscovery: [
bootstrap({
list: bootstrappers,
}),
],
});
node.addEventListener("peer:connect", async (evt) => {
console.log(`Peer ${i} connected`);
});
node.addEventListener("peer:disconnect", async (evt) => {
console.log(`Peer ${i} disconnected`);
});
return node;
};
for (let i = 0; i < 100; i++) {
createNode(i);
} When I use this code, I get the same results, new connections are causing existing connections to drop. However when I change default bootstrapper to: This leads me to believe that the issue has to do with specific peers. However, in my actual use case using default js-waku nodes, I'm only performing 2-3 simultaneous connections and I see connection issues consistently. |
Note, the peer disconnect would potentially not be a problem for my application, but since waku is only connecting to one peer by default (I tried overriding this to connect to more peers) this means that if that peer goes offline all communications in my system are lost, which is a blocker for development. |
This is very interesting. Thanks for opening an issue @x48115 |
Update: @vpavlin mentioned how he ran into something similar while testing a js-waku node against his nwaku node deployed on Akash Network where he saw frequent disconnections to his js-waku node. However, js-waku should still be able to reconnect:
|
I am not sure this is caused/related to js-waku. I see a weird peer behaviour on Akash in general (somehow the connected peers are capped at around 30, although my other node(s) get way more connected peers). |
can we check if other "stabler" nodes also see some disconnections with js-waku? |
@x48115 The reason this is happening is because you're running all js-waku nodes on the same IP, and nwaku has a limit of max 5 connections from the same IP. ref: https://github.com/waku-org/nwaku/blob/master/waku/node/peer_manager/peer_manager.nim#L367-L372 Also, something to note: while unlikely, since this is a p2p network, there can be more reasons why a node might decide to drop a connection (bandwidth restrictions, num peers limit, etc) and that should be not be worrying as the node will keep on finding more peers to connect to. Please feel free to reopen this issue if you're still running into problems. |
Problem
Description
When new peers connect, existing peers sometimes get disconnected
Steps to reproduce:
Expected results
Expected existing peer connections to stay connected when new peers join
Actual results
Peers are disconnected randomly
The text was updated successfully, but these errors were encountered: