Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: go1.6beta1, nil pointer in http.Client #13839
Occurs sometimes under the following conditions
Clients are running on OS X 10.11.2
Looking at the source, it seems to be than
I just read the code again at the version you're using (https://github.com/golang/go/blob/8db371b3d58a1c139f0854738f9962de05ca5d7a/src/net/http/transport.go) and see no way for pc or pc.conn to be nil.
Except perhaps if you're using the Transport.Dial hook and returning (nil, nil) from it.
Is your code available somewhere for me to look at?
Seems it was a race issue.
My stress test code is using a client library.
After protecting this whole section with a mutex I cannot reproduce the panic. (There were 2 other race conditions elsewhere as well but I think they were unrelated.)
A Dial hook is set in the method
Is it possible that the GC can nil things if races occur?
Anyways, I'll close this issue
This is still an issue.
This is most definitely related to unexpected connection shutdowns from the server. If the connection is being closed while the client is reading/writing.
For example, in the case above (using 1.6 beta1), it stopped appearing when extending the Read and Write deadlines on the server in
Now using latest using latest code in the master branch (771da53) it is still appearing even with the change above.
In this case it was when the server got Killed by the system (memory pressure). Probably the same thing again, the client expected the connection to be open and was reading/writing to it.
I had 3 programs running on 3 different machines with several clients running in goroutines, and they all got the same panic at the same time with exactly the same stack trace as above (although different line numbers now):
I am now using a