-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
net/http/httptrace: add retry hook #18305
Comments
Okay, we can document that it may be called multiple times. |
thanks @bradfitz. I was also surprised to see that the |
Who says the request write failed? It looks like the write was successful, but then the server hung up, so it retried because it was safe to do so. |
Should we also add a hook for retries to help the user make sense of multiple WroteRequest/GetConn callbacks? I'm also reminded of #17152. |
Perhaps. But that is Go 1.9. We can re-use this bug. I won't close this one. |
CL https://golang.org/cl/34386 mentions this issue. |
Updates #18305 Change-Id: I63b28d511df1a6c54e32c8bfc7e2264f94e38cd7 Reviewed-on: https://go-review.googlesource.com/34386 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Yes, that would be a successful write, my mistake. It looks like the |
@benburkert interested in documenting your findings? |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.4 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/odjH-4qcwa
What did you expect to see?
The
WroteRequest
hook is called only once for the second request, as it is with the first request, and the program exits normally.What did you see instead?
The
WroteRequest
hook is called twice because the transport attempts to write the request to a dead connection then retries with a new connection. Both attempts call the hook. This causes the program to panic because of the send on the already closed channel during the second call.The text was updated successfully, but these errors were encountered: