go: net/http: source of errors is unclear
What version of Go are you using (go version)?
1.5.3.
What operating system and processor architecture are you using?
Linux. AMD 64.
What did you do?
I’m using httputil.ReverseProxy
to proxy to a host behind ELB, and I’m getting the errors “http: proxy error: net/http: request canceled” & “http: proxy error: net/http: transport closed before response was received” occationally. The line that printed the error is here. And the error came from http.Transport.RoundTrip
.
After more digging, the errors could come from a couple places in http.Transport.RoundTrip
. I was trying to find a way to print the callstacks of the error from http.Transport.RoundTrip
to understand why it was returned but there’s currently no way to do so.
Details can be found in this golang-nuts thread.
What did you expect to see?
I would expect I could instrument a method of either application code or Go’s standard library and find out the callstacks at runtime.
What did you see instead?
No way to find out the callstack of a method from Go’s stdlib. This is a feature request.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 21 (13 by maintainers)
@jingweno, yes, we do the same thing with request tracing inside Google. See https://godoc.org/golang.org/x/net/trace and https://godoc.org/golang.org/x/net/context . Contexts need to be passed explicitly. Automatic contexts leads to tons of problems of confusingly-annotated traces (as witnessed in C++ and Java code trying to use TLS), which is why goroutines don’t have accessible ID numbers. This won’t be added to Go as an automatic thing.
Modify the Go code and see. The error can only come from a few places.