Open mkfsn opened 4 years ago
I have this problem too. Is this(the panic) expected behavior?
I think this is happening when the client closes the connection before the server "renders" reply. But I guess gin could handle this situation better than just "panic".
Same here
2020/07/06 19:49:39 [Recovery] 2020/07/06 - 19:49:39 panic recovered:
http2: stream closed
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/render/json.go:59 (0x90d353)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:841 (0x915765)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:884 (0xdc3da6)
/go/src/project/x/host/server/api/v1/events/events.go:1231 (0xdc3d36)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/src/project/x/host/server/api/antispam/antispam.go:37 (0xd61b30)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/src/project/x/host/server/access.go:71 (0xe2591a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/src/project/x/host/server/access.go:58 (0xe2cc9a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/recovery.go:83 (0x924fef)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/logger.go:241 (0x924120)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/src/project/x/host/server/server.go:82 (0xe2d086)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161 (0x911c1a)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:409 (0x91b6c5)
/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:367 (0x91addc)
/usr/local/go/src/net/http/server.go:2807 (0x6f6d52)
/usr/local/go/src/net/http/server.go:3381 (0x6f88dc)
/usr/local/go/src/net/http/h2_bundle.go:5720 (0x6cb22a)
/usr/local/go/src/runtime/asm_amd64.s:1373 (0x4650d0)
Yeah this problem still happens, it pollutes the logs and the bug reporter. Clients may close the connection unexpectedly, and the server should hand it properly imo.
Any news on this? Log pollution should not be underestimated. It generates a "boy who cried wolf" effect, so when an actual panic happens, a situation that would indeed require attention, it will end up going unnoticed, buried into all the other "panics" that should not have been panics.
+1
+1
After upgrading from
v1.1.2
tov1.6.2
, I sometimes see 500 which is caused by the following error:Looks like before
Render
didn't return the error fromWrite()
:https://github.com/gin-gonic/gin/blob/v1.1.4/render/data.go#L18
but in the latest code it is returning the error:
https://github.com/gin-gonic/gin/blob/v1.6.2/render/data.go#L18
(update)
I created a repo to reproduce the problem: https://github.com/mkfsn/gin-http2-panic