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.handshakeFn cause memory leak #41987
Comments
/cc @FiloSottile |
The change from @For-ACGN is simple and IMHO better than the original version. Any reason not to adopt it? |
Any update on this @FiloSottile @toothrot ? Created another contrived example that seems to reproduce the memory leak. (Edit: Nevermind, once you remove the finalizer the memory stays constant - specific to my example )
Output of
Note that the finalizer is never called, and the memory keeps on growing.
Edit: Nevermind, once you remove the finalizer the memory stays constant. |
@peterrayshen thank you for the code sample. Could you clarify a little, you say that if you don't wrap a finaliser around the connection the memory leak is gone? This is good news, but also, what does this have to do with the crypto/tls package? |
@davecheney Thanks for the response - clarification answered here: https://stackoverflow.com/questions/68011306/golang-crypto-tls-memory-leak. Yeah, the leak in my code snippet doesn't have anything to do with the crypto/tls package, although I thought it did beforehand. I can delete my post to avoid sidetracking the thread/confusing readers - let me know. |
Cool, thanks for explaining. |
Given the lack of response from the OP I will close this issue for now. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
check tls.Conn is destroyed(object unreachable)
What did you expect to see?
destroyed(object unreachable)
What did you see instead?
not destroyed(object reachable)
test code
tls.Conn is not destroyed
fix it that don't use handshakeFn.
fix it and TestTLSConn is passed.
The text was updated successfully, but these errors were encountered: