-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"disconnect" protocol/message #238
Comments
quick thought: this could be made to be part of the identify protocol. |
Maybe? Where do we reconnect to peers on disconnect? We obviously do it but I don't think we're doing it intentionally. I think this is mostly a symptom of how we track connections (we re-dial disconnected peers before we realize we're no longer connected to them). Ideally, sending a FIN packet (for TCP at least) would be enough (don't have to wait). Now, it might be useful to have a "forget me" message but, IMO, that's more useful when shutting down and moving (to invalidate old peerinfo records). |
I think this would be very useful to ensure that peers understand the difference between a connection drop and an intentional close from the other side. I don't think we should rely on the transport having FIN packets (as not all of them do). But I could see a scenario where those are used to implement this if available. |
The benefit of a higher-level message (vs a FIN packet) is that we can model a "disconnect reason", useful for debugging and future extensibility. For example, the devp2p stack in Ethereum models this enum:
It's also useful for higher level aspects, like reputation, peer scoring, quality of service, etc. Peers will want to know if they're being disconnected because their reputation has decreased, or due to packet loss on unreliable transports (e.g. UDP/QUIC), etc. |
It seems odd to place these control messages in a protocol called "identify". Other applications call this "wire protocol" or "control protocol". Maybe a more generic protocol could subsume identify? |
Yeah, it doesnt need to be part of identify. Was just thinking it would be convenient to put it there since identify is required to be in the loop for every connection, and could help in making decisions about allowing new incoming connections. |
(email backlog) So, I've been leaning more and more towards many tiny protocols. Really, I'd just define an entirely new connection "management" protocol. |
@Stebalien those feel juxtaposed. Many tiny protocols != one (coarse-grained) connection management protocol, right? May boil down to terminology, though. Medium-term, I do see a
That way a single stream would be responsible for all connection control messages. Some features in the wire protocol may be optional, e.g. FWIW, this series of requirements is captured in the libp2p roadmap under the Polite peering and wire protocol goal. |
By "connection management", I meant connman stuff. That is, telling users that we're overloaded, telling users to disconnect, etc. Although, really, we could just have one per message
So, this is important for multisteam 1.0 but not for multistream 2.0. That is, there's no reason to keep a stream open in mutlistream 2.0 (unless you just like wasting memory).
This is really why I'd like to push smaller endpoints. Instead of advertising feature maps for protocols, we can just have one "feature" per endpoint. Basically, think of every endpoint as a function. Instead of advertising a function Basically, I'm trying to reduce the amount of state we track per peer per service; it's annoying to manage and takes memory/cpu time. Currently:
|
IMO we will need a control stream, and it should be the swarm that opens that stream before handing over the connection to the libp2p stack. Reason: by introducing connection gating the swarm can decide to immediately close the connection. If we don't open a control stream, we have no way of informing the other party of the reason for that disconnection (e.g. "over capacity"). This would also solve the whole "identify is async but a crucial part of everything else", which has bit us in the butt many times. At this point I would prefer if we don't think of |
I like the suggested control protocol as part of libp2p for all the reasons presented in this thread. It would also create a convenient space for any future control messages to be added. Identify can become just one of its control messages. |
please cover #374 in the control protocol if possible. |
That's an unrelated issue, unfortunately. This issue is about introducing a disconnect message to politely ask another node to disconnect from us (see the motivation). The other issue is a bug somewhere. |
only listen on localhost in tests
Huh, how did this issue get closed? Looks like it happened when I merged go-libp2p-quic-transport into this repo (#1424), and GitHub applied the comment referring to the fix of libp2p/go-libp2p-quic-transport#238 to this repo. This is bad. I wonder how many other issues got closed that way... |
As far as I could tell, none. |
As pointed out by @Kubuxu, it would be really useful to have a way for nodes to tell eachother to disconnect. This way nodes don't assume it was an unintentional disconnection and immediately try to reconnect, among other scenarios.
This could use some discussion.
cc @Kubuxu @vyzo @diasdavid @lgierth @dignifiedquire @magik6k @Stebalien
The text was updated successfully, but these errors were encountered: