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
*: always call Close() on http.Response.Body #75136
Conversation
89ae0be
to
b656f78
Compare
Since go 1.17.6, forgetting to call Close() results in goroutine leaks. Release note: None
b656f78
to
38c4a20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @knz and @stevendanna)
pkg/server/server_test.go, line 272 at r1 (raw file):
According to:
If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close.
Should we only close the body after checking err
is nil below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @stevendanna)
pkg/server/server_test.go, line 272 at r1 (raw file):
Previously, Azhng (Archer Zhang) wrote…
According to:
If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close.
Should we only close the body after checking
err
is nil below?
Actually nvm, the err comes from the io.Copy
TFYR! bors r=Azhng |
Build failed (retrying...): |
Build succeeded: |
Since go 1.17.6, forgetting to call Close() results in goroutine
leaks.
See: golang/go#50652
Release note: None