Skip to content
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

crypto/tls.Conn.Close can block indefinitely #41340

Closed
yahe opened this issue Sep 11, 2020 · 2 comments
Closed

crypto/tls.Conn.Close can block indefinitely #41340

yahe opened this issue Sep 11, 2020 · 2 comments

Comments

@yahe
Copy link

yahe commented Sep 11, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

macOS 10.14.6 (18G6020)

What did you do?

Call Close() on a tls.Conn

What did you expect to see?

The call to Close() to not block, or documentation on the observed behavior

What did you see instead?

Rarely, Close() hangs indefinitely unless I also set a write deadline on the connection.

It's understandable as the TLS conn tries to send a close alert before closing the connection, but it's not clearly stated in the docs, and I wrongly assumed tls.Conn to have the same behavior as the underlying connection. As far as I can tell tls.Conn is the only type to implement the net.Conn interface in the std library to require a wrote deadline not to let Close block indefinitely. Afaict Read has the same "issue" in that it automagically performs the handshake first, with the aggravating factor that having to set a write deadline not to let Read block is even more unintuitive.

@networkimprov
Copy link

This is #31224, which has been passed over in the last two releases :-(

@davecheney
Copy link
Contributor

Duplicate of #31224

@davecheney davecheney marked this as a duplicate of #31224 Sep 12, 2020
@golang golang locked and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants