Fix missing recover while occur panic in handler (#1063)

This commit is contained in:
Eagle Wu 2019-12-27 18:53:11 +08:00 committed by Asim Aslam
parent 2fe64001c0
commit a09b6729cc

View File

@ -374,6 +374,12 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
pool.Release(psock) pool.Release(psock)
// signal we're done // signal we're done
wg.Done() wg.Done()
// recover any panics for outbound process
if r := recover(); r != nil {
log.Log("panic recovered: ", r)
log.Log(string(debug.Stack()))
}
}() }()
for { for {
@ -400,6 +406,12 @@ func (s *rpcServer) ServeConn(sock transport.Socket) {
pool.Release(psock) pool.Release(psock)
// signal we're done // signal we're done
wg.Done() wg.Done()
// recover any panics for call handler
if r := recover(); r != nil {
log.Log("panic recovered: ", r)
log.Log(string(debug.Stack()))
}
}() }()
// serve the actual request using the request router // serve the actual request using the request router