net/http: Memory usage increases on client side when server does not read request's body #43098
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, go1.15.6 is the latest release at the moment.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Please, refer to this gist:
http-server.go
on one tab;http-client.go
on another tab;http-client.go
What did you expect to see?
No errors in the output and amount of memory used by
http-client.go
does not increase.What did you see instead?
http-client.go
like:write tcp [::1]:54091->[::1]:4040: write: protocol wrong type for socket
write tcp [::1]:54096->[::1]:4040: write: broken pipe
http-client.go
increases:http-client.go
Output (errors omitted for brevity)pprof heap snapshots
Bellow snapshots were taken from
http-client.go
:http-client.go
Comparison between heap_start and heap_after_1g
One of "memory consumers" shown by
go tool pprof -base heap_start -http localhost:1234 heap_after_1g
pprof
OutputSome observations
The issue with memory disappears if either is done:
The text was updated successfully, but these errors were encountered: