kubo icon indicating copy to clipboard operation
kubo copied to clipboard

tls: received unexpected handshake message

Open achingbrain opened this issue 5 years ago • 7 comments

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?

achingbrain avatar Jul 01 '20 12:07 achingbrain

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

aschmahmann avatar Jul 01 '20 14:07 aschmahmann

This sounds like TCP simultaneous connect.

Stebalien avatar Jul 01 '20 15:07 Stebalien

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?

RubenKelevra avatar Jul 02 '20 17:07 RubenKelevra

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

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

Stebalien avatar Jul 02 '20 20:07 Stebalien

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

marten-seemann avatar Jul 07 '20 05:07 marten-seemann

@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?

aschmahmann avatar Jul 24 '20 17:07 aschmahmann

I've just encountered the same problem

decrypt-mm avatar Jun 10 '25 00:06 decrypt-mm

Fixed by #10933

gammazero avatar Sep 06 '25 09:09 gammazero

@gammazero I’m not sure #10933 solves this issue since it’s observed outside of the kubo tests which is all that PR changes?

achingbrain avatar Sep 06 '25 12:09 achingbrain