net/http: zero-value Transport is leak-prone #19620
Closed
Labels
Comments
I'm going to close this but I'll mark it as Go2. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The documentation for http.Transport warns:
For users of the API, it may not be obvious that the idle connections may remain open even after the
Transport
becomes unreachable and is garbage-collected.It would be nice if the zero-value Transport represented a configuration that did not leak connections. Better still if we could find a way to automatically close the idle connections when the Transport becomes unreachable.
I don't think this is fixable in Go 1, but we should revisit this aspect of the API if/when we're thinking about Go 2.
(@bradfitz @dsnet @tokkee)
The text was updated successfully, but these errors were encountered: