-
Notifications
You must be signed in to change notification settings - Fork 999
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
AutoNAT: multiple opened connection #2515
Comments
From what I understand, connections don't need to be explicitly closed. |
@elenaf9 I'm using |
same here |
I am not too familiar with the details of gossipsub, but doesn't the gossipsub protocol itself already takes care that you stay connected with the peer in a mesh? What's the benefit of also using the ping for keep-alive? rust-libp2p/protocols/gossipsub/src/handler.rs Lines 271 to 275 in eeb3504
But independent of that, I still agree that The whole logic around keep-alive follows more the idea of "every behaviour protocol decides for themself if they need the substream or not". Afaik none of the protocols explicitly closes a connection? Instead, even after the protocol that initiated the connection doesn't need that connection anymore, it is kept open "in case that any other protocol needs it". And imho network behaviours should not rely on other logic to explicitly close connections again. It could also be the case that the user frequently calls I think ping is really the only protocol that just blindly keeps every substream alive. And the description for its keep-alive actually states that it keeps only the connection alive, not every substream. So what I would propose instead is to change Ping so that it only keeps at least one connection to a peer alive, but not every single one. Overall, I am myself a bit undecided on this. If you still think that AutoNAT should explicitly clean up the connection that are opened in a dial-attempt I am fine with that as well, as I definitely see the reason for it. But my above point still stands. |
Do I understand correctly that you are setting rust-libp2p/protocols/ping/src/handler.rs Lines 52 to 54 in 2ff9ace
Note that connections are kept alive, even without @hamamo if you can provide a small reproducer, or point us to your code itself, that would be great. I know we are not doing a great job documenting the connection lifecycle mechanism in libp2p. Let me know, I can extend the documentation by a paragraph or two in the next couple of days. |
Today I tried setting @mxinden: The code is at https://github.com/hamamo/reputation-net/tree/tokio (the master branch where I used async_std isn't updated yet). I know this is a big ball of spaghetti, didn't have the time yet to come up with a clean small example showing the issue. |
That is surprising to me. Once a peer joins a mesh, the https://github.com/libp2p/rust-libp2p/blob/master/protocols/gossipsub/src/handler.rs#L132-L134 Could you check whether a peer successfully joins a mesh but is still disconnected? Also could you post the logs ( |
Just a wild guess, seeing logic in https://github.com/hamamo/reputation-net/blob/tokio/src/reputation_net/mod.rs |
We are reworking idle connection management, see #4306. I am closing this as stale. |
It seems that AutoNAT opens peer connections as part of its probing loop but does not close them again, so after some time connected peers have dozens of open connections between them. I only have a very rudimentary understanding of the implications but it doesn't look quite right :-)
The text was updated successfully, but these errors were encountered: