-
Notifications
You must be signed in to change notification settings - Fork 957
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
Invalid Swarm behaviour #2242
Comments
Ok, I did a bit of digging. It looks like in #2191 for new connections beyond a connection limit we close the connection. Previously we reported a PendingConnectionError as a PoolEvent. I think we then are injecting connection closed events to the behaviour with the If this is the intended behaviour, I'll have to update some assumptions in gossipsub and maybe some other behaviours I've built What do you guys think? @thomaseizinger @mxinden |
I've also seen the following panics
So I assume we probably need to change the behaviour of how the connections are reported. |
Thank you @AgeManning for the debugging work. Sorry for the trouble this has caused on your end.
This is exactly right! In #2191 I changed the behaviour on how connection limit errors are reported. Long story short, I did so in order to be able to return the handler to the behaviour on connection limit errors. More specifically in pool.rs in case the established-limit is reached, I do not report a
While returning the handler along with the error was obviously the intention of #2191, triggering a First solution that comes to my mind which would retain the intended behaviour of #2191 (returning the handler), while upholding the guarantee that every What do people think? Does someone have the need to differentiate in pending and established connection limit? |
Merge pending and established limits for both incoming and outgoing connections. More specifically merge `ConnectionLimits::with_max_pending_incoming` with `ConnectionLimits::with_max_established_incoming` and `ConnectionLimits::with_max_pending_outgoing` with `ConnectionLimits::with_max_established_outgoing`. Connection limits are checked on `Network::dial` for outgoing and on `Network::accept` for incoming connections. This (a) simplifies connection limits from an implementations and user perspective and (b) simplifies returning a connection handler on limit error as limits can only be exceeded at the start of dialing and accepting. See [1]. [1]: libp2p#2242 (comment)
#2253 showcases the solution suggested above. |
I still need to dig deeper into these failures. I am not yet sure whether they are related. |
This sounds good to me. I had a look at the identify panic, and it is definitely related, assume the |
Concurrently dial address candidates within a single dial attempt. Main motivation for this feature is to increase success rate on hole punching (see #1896 (comment) for details). Though, as a nice side effect, as one would expect, it does improve connection establishment time. Cleanups and fixes done along the way: - Merge `pool.rs` and `manager.rs`. - Instead of manually implementing state machines in `task.rs` use `async/await`. - Fix bug where `NetworkBehaviour::inject_connection_closed` is called without a previous `NetworkBehaviour::inject_connection_established` (see #2242). - Return handler to behaviour on incoming connection limit error. Missed in #2242.
From what I can tell the latest master has resolved this |
Concurrently dial address candidates within a single dial attempt. Main motivation for this feature is to increase success rate on hole punching (see libp2p/rust-libp2p#1896 (comment) for details). Though, as a nice side effect, as one would expect, it does improve connection establishment time. Cleanups and fixes done along the way: - Merge `pool.rs` and `manager.rs`. - Instead of manually implementing state machines in `task.rs` use `async/await`. - Fix bug where `NetworkBehaviour::inject_connection_closed` is called without a previous `NetworkBehaviour::inject_connection_established` (see libp2p/rust-libp2p#2242). - Return handler to behaviour on incoming connection limit error. Missed in libp2p/rust-libp2p#2242.
I've been testing some code on the latest master and running into unexpected behaviour from the Swarm.
I've found that Swarm is injecting a
ConnectionId
to the behaviour viainject_connection_established()
. In some less-common circumstances (which I've not isolated) upon disconnection, viainject_connection_closed()
the Swarm is inputting a different connection id.In gossipsub, this causes a panic as we are expecting the swarm to inform the behaviour of the past-injected connection, not a new one.
The text was updated successfully, but these errors were encountered: