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
Adding r.Use(gin.Recovery() does not change the outcomes below.
Do a curl https://localhost:8080 -k (especially with nghttp2 support built in) and CTRL+C (or TERM, or KILL) before the server has a chance to read a response. The result should be something like:
http2: panic serving [::1]:54808: http2: stream closed
// stacktrace here
Similarly a curl http://localhost:8181 that's terminated too early:
That Context.JSON panics when the stream is closed too early means that in larger apps it's much more difficult for the app to gracefully degrade. The recovery handler is thus handling app-created panics (e.g.: the dev messed up) as well as panics that will necessarily occur in real-world use cases (e.g.: the user stopped loading the request, or a proxy reset the connection early).
It also pollutes stderr with stack traces that show that, yes, in fact, a user closed the socket before we could write the response.
The text was updated successfully, but these errors were encountered:
Proof of Concept here: https://gist.github.com/scottmmjackson/c35f4609750d9c6907a464780e55097a
Adding
r.Use(gin.Recovery()
does not change the outcomes below.Do a
curl https://localhost:8080 -k
(especially with nghttp2 support built in) and CTRL+C (or TERM, or KILL) before the server has a chance to read a response. The result should be something like:Similarly a
curl http://localhost:8181
that's terminated too early:That
Context.JSON
panics when the stream is closed too early means that in larger apps it's much more difficult for the app to gracefully degrade. The recovery handler is thus handling app-created panics (e.g.: the dev messed up) as well as panics that will necessarily occur in real-world use cases (e.g.: the user stopped loading the request, or a proxy reset the connection early).It also pollutes stderr with stack traces that show that, yes, in fact, a user closed the socket before we could write the response.
The text was updated successfully, but these errors were encountered: