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/httputil: Question about new panic in ReverseProxy #28239
Comments
Also, can we get the original The panic obfuscates the original error with a generic |
Are you not using http.Server? The http.Server automatically handles ErrAbortHandler. |
Also, #23643 which was included in Go 1.11 was supposed to even fix the case of not running under an http.Server. So I'm really curious about your environment. Do you have a minimal repro? |
@bradfitz yes, we're using http.Server. The panic is handled and the program doesn't crash. However, we use some HTTP middlewares that report all panics to Sentry and to our Logs. And now I'm curious what to do with this generic error. Should we start filtering http.ErrAbortHandler out? |
I don't know what your middleware wants to do, but here's the documentation for that panic value: https://golang.org/pkg/net/http/#ErrAbortHandler
You can modify your middleware as appropriate. There is no way to get the original cause. Usually it's because the client went away (closed browser tab, etc) and the proxy copy thus failed. |
OK. I think it makes sense to suppress these errors in our middleware too. Thanks! |
Based on discussion golang/go#28239 .
What version of Go are you using (
go version
)?go version go1.11.1 darwin/amd64
What did you do?
We use
httputil.ReverseProxy
in a HTTP Handler to proxy the S3 file download.We started seeing
panic: net/http: abort Handler
messages in our logs/alert platform, since go1.11.The stacktrace leads to a new
panic(http.ErrAbortHandler)
in(*ReverseProxy).ServeHTTP()
method:go/src/net/http/httputil/reverseproxy.go
Lines 276 to 287 in a0d6420
Question
Are we supposed to defer-recover from this new
panic()
from now on?I feel this should be documented at https://golang.org/pkg/net/http/httputil/#ReverseProxy .. but it's not.
The text was updated successfully, but these errors were encountered: