net/http: TimeoutHandler allows wrapped handlers crash server with panics #22084
Comments
/cc @tombergan @bradfitz |
Change https://golang.org/cl/67410 mentions this issue: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/Ycz0W8a_ff
What did you expect to see?
I expect panics from http.Handlers to be handled by http.Server as documented (recovered), i.e. with the sentinel panic value http.ErrAbortHandler this program outputs something like this:
What did you see instead?
Program crashes:
System details
This happens because TimeoutHandler starts original handler in a separate goroutine:
go/src/net/http/server.go
Lines 3042 to 3045 in 78a0a31
I can work on fixing this by handling panic in this goroutine and re-raising it from the
timeoutHandler.ServeHTTP
itself, so it's handled by the Server. Please assign this to me if this solution looks ok.The text was updated successfully, but these errors were encountered: