-
Notifications
You must be signed in to change notification settings - Fork 964
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
FloodSub is not working as of b8a312f7d512c25f86bc16989cb588900483946d #843
Comments
One possible fix that would make sense to me is to have |
But do we have such information on |
We can have the |
Maybe it makes sense to move |
At the lower level each connection to a remote gets its own tokio task, supposedly asynchronous from the network behaviours. If we put |
I see. In that case, I'd suggest to add something like keep_alive flag to the FloodsubHandler, which is initialized to true on start, and can be turned off by |
@tomaka Couldn't this perhaps be implemented at the TcpConfig level? I mean, all TCP connections need to be kept alive no matter the layer above, is there a use case where someone might want the TCP transport to just destroy one? |
@drozdziak1 The issues right now is that we purposefully destroy TCP connections when they become unused. We don't want to stay connected to everyone forever, especially if you are in a network that is made of thousands of nodes. |
Yeah, I mean having the TCP transport implement some form of smarter connection GC? Like a "last_used" timestamp with a configurable time window, like 15 minutes? Or a connection cap where you only keep up to N connections alive at a time and destroy the one with oldest "last_used" when you want to open another (N+1)th? Perhaps we could have some different modes for this, and maybe let the user specify a filter closure that could sort connections by a priority metric of their choosing? |
The "last used" thing is already implemented, except that it's configured to 5 seconds right now. |
So when I run the chat example with My general impression is that this is hard to fix mainly because of the mental overhead of the architecture. Is there any refactor options you find worth considering, which could help this issue? |
@drozdziak1 Here s the fork - https://github.com/stegos/rust-libp2p/tree/stegos |
Thanks @echupriyanov! I'm more looking to help fix this properly for everyone else though. |
I think that a proper fix goes in pair with #854. |
@tomaka Thanks! I'll try to understand that when I find the time. |
Should work fine now. |
@tomaka what is the solution to this problem?? The code has changed quite a bit since stegos's fork. Thanks in advance! |
At present master (commit b8a312f)
FloodSub doesn't seem to work properly.
When I run provided
chat
example, I don't see messages being delivered between nodes.Running example with debug enabled, I see, that dialed TCP connection is dropped immediately after successful negotiation.
Changing
FloodsubHandler::connection_keep_alive()
to always returntrue
resolves this issue.My guess is that this happens because:
libp2p
closes idle (useless
?) TCP connectionsfloodsub
closes the substream after successful send.So, we end up with no TCP connection between nodes.
The text was updated successfully, but these errors were encountered: