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
net/http: http.Transport leaks context from the request #50798
Comments
Change https://golang.org/cl/380674 mentions this issue: |
CC @neild |
We seem to be having the same problem. In long running instances, memory utilization is going up every day reaching 80-90% in ~12 days. We started seeing this issue when we upgraded from Go 1.11.3 (no modules) to 1.17 (with go-modules), before the Memory would stay under 30%. Servers have 4GBs. When I run
|
Same issue, there is some news about this? |
In case this helps someone, this other ticket was closed with a comment explaining how to avoid this issue: newrelic/go-agent#447 (comment) |
Well I spotted in my case the solution, I have a global scope context that are aware when a term signal come and all of my workers need to be stopped when it comes. So every time a job start I create a new context with cancel and defer it. With this simple change the leak over bufio.NewWriterSize/bufio.NewReaderSize into transport disappear. |
Any update on this issue? |
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?
I use the
http.Transport
to make an HTTP request. I add a not empty struct in the request context.You can reproduce it like this
What did you expect to see?
After the end of the request, the struct and the context are cleaned by the GC.
What did you see instead?
After the end of the request, the struct and the context are not cleaned by the GC.
Maybe this is the same issue as #43966
The text was updated successfully, but these errors were encountered: