-
Notifications
You must be signed in to change notification settings - Fork 18.1k
net/http: fix request canceler leak on http.Transport #62296
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
Conversation
A write error in pconn.writeLoop when channel waitForBodyRead in pconn.readLoop is still blocking will cause the request canceler never be removed. This would cause memory leak in http.Transport. Note that the write error could be either "http: invalid Read on closed" (issue 61708 case, req body was close by (*chunkWriter).writeHeader src/net/http/server.go:1405 while (*persistConn).writeLoop is still reading it. A reverseproxy specific problem.) or "http: ContentLength=1048576 with Body length 1" (PR unit test case). Without the fix: pending requests = 5; want 0. With the fix: ALL TESTS PASSED. Thanks the previous works done by @AlexanderYastrebov. Fixes golang#61708
This PR (HEAD: 4a3f425) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/522916. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/522916. |
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/522916. |
This PR (HEAD: 12ed72e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/522916. Important tips:
|
Message from Zach Fok: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/522916. |
Message from Damien Neil: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/522916. |
A write error in pconn.writeLoop when channel waitForBodyRead in pconn.readLoop is still blocking will cause the request canceler never be removed. This would cause memory leak in http.Transport.
Note that the write error could be either "http: invalid Read on closed" (issue 61708 case, req body was close by (*chunkWriter).writeHeader src/net/http/server.go:1405 while (*persistConn).writeLoop is still reading it. A reverseproxy specific problem.) or "http: ContentLength=1048576 with Body length 1" (PR unit test case). Without the fix: pending requests = 5; want 0. With the fix: ALL TESTS PASSED.
Thanks the previous works done by @AlexanderYastrebov.
Fixes #61708
This PR will be imported into Gerrit with the title and first
comment (this text) used to generate the subject and body of
the Gerrit change.
Please ensure you adhere to every item in this list.
More info can be found at https://github.com/golang/go/wiki/CommitMessage
net/http: frob the quux before blarfing
"This change modifies Go to ___________"
really needed (ASCII art, table, or long link)
Fixes #1234
orUpdates #1234
(the latter if this is not a complete fix) to this comment
golang/go
you can use theowner/repo#issue_number
syntax:Fixes golang/tools#1234
Our Gerrit server & GitHub bots enforce CLA compliance instead.