-
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
Simultaneous connection opening with TCP+TLS #732
Comments
I'm not sure if this is actually triggering the old libp2p/go-libp2p-swarm#79 . But this would mean that the connection notifier perhaps triggers while the connection is not fully setup yet and TLS is negotiated, therefore it is not usuable and that's why it tries to open a new one? |
That means we don't know any addresses so we're giving up.
It generally should.
That really is pointing to a simultaneous connection issue: https://github.com/libp2p/go-libp2p-swarm/blob/5efa2fa248976bbdc141f638ead80cbf7ab689cf/swarm.go#L291-L334.
This can happen when the connection we created is killed before we get to actually use it. |
Does the |
No. The connection notification fires at the very end.
This should be impossible. |
So I think the TLS problem is fixed. The I need to verify things with QUIC though, as I remember having seen something similar at least. |
@hsanjuan I'm not sure I completely understand the issue here, but there's no such thing as simultaneous open in QUIC. You'll end up with two separate QUIC connections when two peers are dialing each other simultaneously. |
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes #6197 related to libp2p/go-libp2p#732
fixes ipfs#6197 related to libp2p/go-libp2p#732
fixes ipfs#6197 related to libp2p/go-libp2p#732
fixes ipfs#6197 related to libp2p/go-libp2p#732
This has likely been fixed. |
fixes ipfs/kubo#6197 related to libp2p/go-libp2p#732
I have what seems a race condition when opening a NewStream to a host. This has only become apparent when using TCP Transport + TLS. It did not happen (at least not usually) with TCP+secio and does not seem to happen with QUIC (at least not so often).
We are using libp2p-0.4.0:
go list -m all | grep libp2p
github.com/lanzafame/go-libp2p-ocgorpc v0.1.1 github.com/libp2p/go-addr-util v0.0.1 github.com/libp2p/go-buffer-pool v0.0.2 github.com/libp2p/go-conn-security v0.0.1 github.com/libp2p/go-conn-security-multistream v0.1.0 github.com/libp2p/go-eventbus v0.1.0 github.com/libp2p/go-flow-metrics v0.0.1 github.com/libp2p/go-libp2p v0.4.0 github.com/libp2p/go-libp2p-autonat v0.1.0 github.com/libp2p/go-libp2p-autonat-svc v0.1.0 github.com/libp2p/go-libp2p-blankhost v0.1.4 github.com/libp2p/go-libp2p-circuit v0.1.3 github.com/libp2p/go-libp2p-connmgr v0.1.1 github.com/libp2p/go-libp2p-consensus v0.0.1 github.com/libp2p/go-libp2p-core v0.2.3 github.com/libp2p/go-libp2p-crypto v0.1.0 github.com/libp2p/go-libp2p-discovery v0.1.0 github.com/libp2p/go-libp2p-gorpc v0.1.0 github.com/libp2p/go-libp2p-gostream v0.2.0 github.com/libp2p/go-libp2p-host v0.1.0 github.com/libp2p/go-libp2p-http v0.1.4 github.com/libp2p/go-libp2p-interface-connmgr v0.0.5 github.com/libp2p/go-libp2p-interface-pnet v0.1.0 github.com/libp2p/go-libp2p-kad-dht v0.2.1 github.com/libp2p/go-libp2p-kbucket v0.2.1 github.com/libp2p/go-libp2p-loggables v0.1.0 github.com/libp2p/go-libp2p-metrics v0.0.1 github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-nat v0.0.4 github.com/libp2p/go-libp2p-net v0.0.2 github.com/libp2p/go-libp2p-netutil v0.1.0 github.com/libp2p/go-libp2p-peer v0.2.0 github.com/libp2p/go-libp2p-peerstore v0.1.3 github.com/libp2p/go-libp2p-pnet v0.1.0 github.com/libp2p/go-libp2p-protocol v0.1.0 github.com/libp2p/go-libp2p-pubsub v0.1.1 github.com/libp2p/go-libp2p-quic-transport v0.1.2-0.20190830164807-17543aa14ed2 github.com/libp2p/go-libp2p-raft v0.1.3 github.com/libp2p/go-libp2p-record v0.1.1 github.com/libp2p/go-libp2p-routing v0.1.0 github.com/libp2p/go-libp2p-secio v0.2.0 github.com/libp2p/go-libp2p-swarm v0.2.2 => /home/hector/go/src/github.com/libp2p/go-libp2p-swarm github.com/libp2p/go-libp2p-testing v0.1.0 github.com/libp2p/go-libp2p-tls v0.1.1 github.com/libp2p/go-libp2p-transport v0.0.5 github.com/libp2p/go-libp2p-transport-upgrader v0.1.1 github.com/libp2p/go-libp2p-yamux v0.2.1 github.com/libp2p/go-maddr-filter v0.0.5 github.com/libp2p/go-mplex v0.1.0 github.com/libp2p/go-msgio v0.0.4 github.com/libp2p/go-nat v0.0.3 github.com/libp2p/go-openssl v0.0.2 github.com/libp2p/go-reuseport v0.0.1 github.com/libp2p/go-reuseport-transport v0.0.2 github.com/libp2p/go-stream-muxer v0.1.0 github.com/libp2p/go-stream-muxer-multistream v0.2.0 github.com/libp2p/go-tcp-transport v0.1.1 github.com/libp2p/go-testutil v0.1.0 github.com/libp2p/go-ws-transport v0.1.2 github.com/libp2p/go-yamux v1.2.3(go-libp2p-swarm replaced to add some logging).
The procedure is the following:
libp2p.Security
option. The listen multiaddress indicates a random port 0. The identity is an RSA-2048 key.max dial attempts failed
.dht, bitswap, connection manager, nat port mapping or relay in these tests.Adding some logging to libp2p-swarm shows:
Notice the following:
connection error
:no addresses
that sometimes appears and happens to be after peer1 tries to contact peer2 (why is it not re-using the existing connections?)finished dialing
messages that indicates that several connections were producedbestConnToPeer
and things work, sometimes things die in the retry, sometimes there is no retry as no connection existed in the first place and DialAttempts is reached. In this case after the EOF, it seems the connection used was closed (this is extra logging added by myself).I am a bit lost here, but it seems that there should not be so many connections being opened or attempted and that streams should not get a closed connection.
The text was updated successfully, but these errors were encountered: