-
Notifications
You must be signed in to change notification settings - Fork 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
gossipsub + tokio: unexpected warning #2897
Comments
There are connection fail errors before and after those 2 warnings. Although I would have to check my logs and experiments with some of my code but the only time ive seen this is of a peer suddenly disconnects before everything was received (eg crash, process terminated), hence the unexpected eof, but dont believe I've seen it specifically in gossip. It might not show up in floodsub because the warnings arent there but could be wrong |
The reason why it might not show up in floodsub might be because it doesn't have as much logging (I didn't check the code).
Are you closing the connection gracefully or just shutting the peer down? |
@thomaseizinger I'm just shutting the peer down, which would explain the warning indeed. I haven't seen it yet, what's the idiomatic way to shut down the connection in rust-libp2p? |
Unfortunately there is no graceful shutdown for a libp2p node today. See #1682 for a previous attempt. I don't think any of us are going to get to this any time soon. That said, contributions are welcome. |
All of the above will - to my knowledge - try to gracefully close the connection before freeing any resources. |
Thanks a lot for the suggestions, I'll try them out and see if the warning persists. |
So, I looked into the docs and tried to implement a graceful disconnection before shutting down the application. To my understanding of the docs, the only public method available to me from the swarm object is So, additional questions/remarks:
I'm slowly diving in the code but I'm afraid my current knowledge of Rust and libp2p is too narrow to fix this by myself. |
I think the issue we are facing here is that gossipsub actually keeps substreams alive, which is something rather unsual across most libp2p protocols. Most protocols open a stream, send some data and close it again. Thus, it is highly unlikely that a connection gets closed right inbetween when a substream is active. For a graceful shutdown of the streams within gossipsub, I think it may depend on the underlying It may also be that we are not properly closing all streams when we shutdown a connection. |
I'm using mplex. Should I try using yamux to see if it makes any difference? |
Yes please try with rust-libp2p/muxers/mplex/src/io.rs Lines 170 to 172 in bcff814
We do close the muxer as part of graceful connection shutdown but mplex doesn't gracefully close open streams as part of that. |
Let me know if this is still an issue. |
Summary
Hello! I'm interested in running a gossipsub-based application with Tokio as a runtime. As a first step, I revamped the gossipsub-chat example with Tokio as a runtime (mixing elements from the
chat-tokio
example). While the communication works, I get two warnings when closing one of the peers:This warning does not occur with the floodsub example, so I'm wondering what's going on and whether it will have an impact down the line. From what I can determine it looks like the end of the connection results in an EOF instead of a graceful closing.
Debug Output
I pushed the code for the example on this repository: https://github.com/odesenfans/rust-libp2p-gossipsub-tokio. Any ideas?
Version
Cheers,
Olivier
The text was updated successfully, but these errors were encountered: