Skip to content

net/http: fix memory leak in http.Transport #50799

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

Closed
wants to merge 1 commit into from

Conversation

juliens
Copy link
Contributor

@juliens juliens commented Jan 25, 2022

The wantConnQueue keeps reference on wantConn which keeps reference on
the request context until the next request for the same key.
This can be a problem if you never have another request with the same key.
So now, we clean the idleConnWait/connsPerHostWait after returning the
response or error for a getConn.

Fixes #50798

@gopherbot
Copy link
Contributor

This PR (HEAD: 891f3d3) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/380674 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Damien Neil:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/380674.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Julien SALLEYRON:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/380674.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Damien Neil:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/380674.
After addressing review feedback, remember to publish your drafts!

The wantConnQueue keeps reference on wantConn which keeps reference on
the request context until the next request for the same key.
This can be a problem if you never do another request with the same key.
So now, we force the clean of the idleConnWait/connsPerHostWait after returning the
response or error for a getConn.
@juliens juliens force-pushed the fix/transport-memory-leak branch from 891f3d3 to cfb09a0 Compare May 4, 2022 09:22
@gopherbot
Copy link
Contributor

This PR (HEAD: cfb09a0) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/380674 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Alexander Yastrebov:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/380674.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from [email protected]:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/380674.
After addressing review feedback, remember to publish your drafts!

@seankhliao seankhliao closed this Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

net/http: http.Transport leaks context from the request
3 participants