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
http.Server handles panics in request handler goroutines using recover, but other servers used by Consul do not. By handling panics in request handlers we will prevent any panics in request handlers from shutting down the entire process.
HTTP API should already work correctly because http.Server handles panics
the Server port has many services behind it. Server.handleConsulConn can recover from most, but we should also look at Server.handleSnapshotConn and Server.handleInsecureConn and probably do the same there.
DNS interface - unknown. needs investigation
The text was updated successfully, but these errors were encountered:
Concerning grpc.Server, what do we want to do with the panic? Just turn it into a codes.Internal error? http.Server also prints the stack trace to stderr. If stack trace is not needed, something like the following should suffice:
This is a prototype, if this approach is confirmed, I plan to add comments, tests and perhaps try to find a way to make the middleware registration common in a shared function.
Returning codes.Internal and printing the stack trace using logger.Warn (or logger.Error) sounds like a good way of handling a panic. That diff also looks like a good start!
http.Server handles panics in request handler goroutines using
recover
, but other servers used by Consul do not. By handling panics in request handlers we will prevent any panics in request handlers from shutting down the entire process.http.Server
handles panicsgrpc.Server
can use grpc-middleware/recover (or an interceptor with a similar implementation)grpc.Server
can use the sameServer.handleConsulConn
can recover from most, but we should also look atServer.handleSnapshotConn
andServer.handleInsecureConn
and probably do the same there.The text was updated successfully, but these errors were encountered: