labstack / echo

High performance, minimalist Go web framework
https://echo.labstack.com
MIT License
29.01k stars 2.21k forks source link

cant print debug stack using middleware Recover() and Timeout() #2634

Open gitouyoung opened 1 month ago

gitouyoung commented 1 month ago

This is my middlewares:

middleware.Recover(),
middleware.TimeoutWithConfig(middleware.TimeoutConfig{
    Skipper: func(c echo.Context) bool {
        return strings.HasPrefix(c.Request().RequestURI, "/debug/pprof/")
    },
    ErrorMessage: "timeout",
    Timeout:      10 * time.Second,
}),

after I add timeout middleware, log cannot show where panic occurs, the stack output always be like :

image

If I remove timeout middleware, log shows where panic occurs. the stack output is:

image

I wonder how can Recover() print panic stack correctly while using both Recover() and Timeout()