You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ErrAbortHandler is a sentinel panic value to abort a handler.
// While any panic from ServeHTTP aborts the response to the client,
// panicking with ErrAbortHandler also suppresses logging of a stack
// trace to the server's error log.
var ErrAbortHandler = errors.New("net/http: abort Handler")
@bbasic Could you provide a pull request with tests to reproduce the log panic?
Based on the Go http server implementation I'm also in favor of not logging this panic in the recover middleware as it is not something that is an actual error or misbehavior.
Issue Description
Using proxy and recover middleware would print the panic log in cases where the HTTP client aborts the request.
The error that is recovered is
http.ErrAbortHandler
. That one is a special error to signal aborting the HTTP handler and should not be logged.From
net/http/server.go
https://github.com/golang/go/blob/88be85f18bf0244a2470fdf6719e1b5ca5a5e50a/src/net/http/server.go#L1775:It should be ignored the same way as it is done in
net/http/server.go
.https://github.com/golang/go/blob/88be85f18bf0244a2470fdf6719e1b5ca5a5e50a/src/net/http/server.go#L1799
See also the comment I found here golang/go#28239 (comment)
Checklist
Expected behaviour
No stack trace for recovery of the
ErrAbortHandler
Actual behaviour
I am seeing log such as:
Steps to reproduce
Version/commit
github.com/labstack/echo/v4 v4.7.1
The text was updated successfully, but these errors were encountered: