timeout icon indicating copy to clipboard operation
timeout copied to clipboard

Timeout middleware for Gin

Results 19 timeout issues
Sort by recently updated
recently updated
newest added

不使用时能正常获取到panic的具体文件行号,使用了后,不管怎么调整runtime.Caller的skip参数都无法获取到了,runtime.Callers也获取不行,使用了后不管是哪个文件panic获取的runtime信息都会指示为timeout中间件panic了

Running `go test` with `-race` flag fails with detecting a race. The go routine for the handler calling `Next()` is accessing the same variable as the call to `Abort()` after...

bug

If set the handler time.Sleep same as the timeout, there is a chance to reproduce this error! ```go api.GET("/test", timeout.New( timeout.WithTimeout(200*time.Microsecond), timeout.WithHandler(func(c *gin.Context) { time.Sleep(200*time.Microsecond) c.JSON(http.StatusOK, gin.H{ "code": 200, "data":...

bug

Resolve the #15 `fatal error: concurrent map writes` issue ## Cause In the current implementation, when a timeout occurs, `c.Writer` is replaced with `&gin.responseWriter` and writing to the Body is...

bug

timeout handler would better insert stack info to error when recover from panic.

I test gin-timeout, and it's ok https://github.com/vearne/gin-timeout/blob/master/timeout.go#L33 ``` cp := *c //nolint: govet c.Abort() // sync.Pool buffer := buffpool.GetBuff() tw := &TimeoutWriter{body: buffer, ResponseWriter: cp.Writer, h: make(http.Header)} tw.TimeoutOptions = defaultOptions...

# Summary We ran into a use case where certain longer running endpoints needed their timeout to be extended beyond what the rest of the API required due to longer...

When a handler passed to `timeout.WithHandler` completed and the middleware timed out at the same time, the context writes both response bodies or panics due to concurrent writes. ### Reproduction...

- With issues: - Use the search tool before opening a new issue. - Please provide source code and commit sha if you found a bug. - Review existing issues...

If you use multiple custom middlewares then the timeout middleware will overwrite previous status codes. ```go package main import ( "log" "net/http" "time" "github.com/gin-contrib/timeout" "github.com/gin-gonic/gin" ) func testResponse(c *gin.Context) {...