net/http: possible readloop goroutine leak #10457
What we meet
We encountered this goroutine leak in our own project(https://github.com/coreos/etcd) when using the function to check the goroutine that is still running after test finishes:
The error is under go 1.4.2
The case is writeLoop is closed, but readLoop is still there, and hangs on
What we have found
After digging into it, @xiang90 find this, and we think that is the root cause of the leak.
(All codes are excerpted from "pkg/net/http/transport.go" in go1.4)
The loop in
Can we reproduce it?
I can get the leak when running etcd integration tests once in five round in race mode.
I have done my best to reproduce it in a simple go program(2-3 full days), but i failed to make it happen because it is really hard to let the code run in the order that is described in bug case.
i hope that you can read over the bug case, and i can help on testing whether this is fixed.