ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.04k stars 3k forks source link

tls: received unexpected handshake message #7516

Open achingbrain opened 4 years ago

achingbrain commented 4 years ago

I sometimes see this error while running pubsub tests using go-ipfs over the js ipfs-http-client:

HTTPError: connect QmewgY9zBbguYZmTjjhXmzLdmEWk7UJc7bDmnNQiex1PtR failure: failed to dial QmewgY9zBbguYZmTjjhXmzLdmEWk7UJc7bDmnNQiex1PtR: all dials failed
  * [/ip4/127.0.0.1/tcp/52633] failed to negotiate security protocol: tls: received unexpected handshake message of type *tls.clientHelloMsg when waiting for *tls.serverHelloMsg

It's during the test setup, it's started three go-ipfs nodes and is using ipfs.swarm.connect to get them to dial each other.

Any idea what could be causing this?

aschmahmann commented 4 years ago

not really sure, would have to do some looking into it. @Stebalien any ideas?

Stebalien commented 4 years ago

This sounds like TCP simultaneous connect.

RubenKelevra commented 4 years ago

This sounds like TCP simultaneous connect.

You're sure? An incoming connection should use a different file descriptor - shouldn't it?

Maybe we skip dialing when we have an incoming connection, use this and forget to flip the direction?

Stebalien commented 4 years ago

https://github.com/libp2p/go-tcp-transport/issues/21

http://ttcplinux.sourceforge.net/documents/one/tcpstate/tcpstate.html

marten-seemann commented 4 years ago

This is a TCP simultaneous connect, as @Stebalien said. We had a proposal somewhere to handle this gracefully, but it was never implemented.

aschmahmann commented 4 years ago

@marten-seemann @Stebalien was there an agreed upon solution to this that we haven't implemented yet, or is this still in the "we need to figure it out how to do this correctly" stage?