net/http: TimeoutHandler hides panic after timeout #34608
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
If
TimeoutHandler
's inner handler panics after the timeout, the panic is discarded:https://play.golang.org/p/GT7lVCBu163
This happens because after the timeout,
TimeoutHandler.ServeHTTP
doesn't wait for the inner handler to complete, and anything onpanicChan
is lost.I understand that waiting for the inner handler would partly defeat the purpose of
TimeoutHandler
. If waiting is not acceptable, perhaps the docs should warn about dropped panics.Also,
timeoutWriter.Push
panics if called after the timeout:https://play.golang.org/p/-AZj5t-ViyJ
(Not sure if this should be a separate issue.)
This happens because
timeoutWriter.Push
may call the underlyingPush
after or concurrently with the completion ofTimeoutHandler.ServeHTTP
(after whichhttp2responseWriter.rws
is set to nil).Of course the panic is not logged for the reason already mentioned.
The text was updated successfully, but these errors were encountered: