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
First of all, thanks for this library! The performance gains are very noticeable.
I found that when there is a panic during data fetch inside the handler, then the panic cannot be recovered even if there is a panic recovery middleware present in the middleware chain or if there is a recovery middleware wrapping the stampede cache handler itself.
I believe this is because the singleflight package here creates a goroutine and if a panic occurs in that goroutine, then it can never be recovered in the main goroutine.
First of all, thanks for this library! The performance gains are very noticeable.
I found that when there is a panic during data fetch inside the handler, then the panic cannot be recovered even if there is a panic recovery middleware present in the middleware chain or if there is a recovery middleware wrapping the stampede cache handler itself.
I believe this is because the
singleflight
package here creates a goroutine and if a panic occurs in that goroutine, then it can never be recovered in the main goroutine.stampede/singleflight/singleflight.go
Lines 68 to 71 in 39949d2
The fix should be to recover the panic properly in the callback function within
HandlerWithKey
and set the error properly.stampede/http.go
Lines 82 to 95 in 39949d2
The text was updated successfully, but these errors were encountered: