diff --git a/go.sum b/go.sum index 386c988..533cc8f 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= diff --git a/grpc.go b/grpc.go index f4f2299..b50d2a2 100644 --- a/grpc.go +++ b/grpc.go @@ -7,7 +7,6 @@ import ( "fmt" "net" "reflect" - "runtime/debug" "sort" "strconv" "strings" @@ -20,7 +19,7 @@ import ( "go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/errors" "go.unistack.org/micro/v3/logger" - metadata "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/server" "golang.org/x/net/netutil" @@ -204,19 +203,6 @@ func (g *Server) handler(srv interface{}, stream grpc.ServerStream) (err error) return status.New(codes.InvalidArgument, err.Error()).Err() } - defer func() { - if r := recover(); r != nil { - g.RLock() - config := g.opts - g.RUnlock() - if config.Logger.V(logger.ErrorLevel) { - config.Logger.Errorf(config.Context, "panic in %s.%s recovered: %v", serviceName, methodName, r) - config.Logger.Error(config.Context, string(debug.Stack())) - } - err = errors.InternalServerError(g.opts.Name, "panic in %s.%s recovered: %v", serviceName, methodName, r) - } - }() - if g.wg != nil { g.wg.Add(1) defer g.wg.Done() diff --git a/subscriber.go b/subscriber.go index 8199717..677f37c 100644 --- a/subscriber.go +++ b/subscriber.go @@ -4,12 +4,9 @@ import ( "context" "fmt" "reflect" - "runtime/debug" "strings" "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/errors" - "go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/server" @@ -104,15 +101,6 @@ func newSubscriber(topic string, sub interface{}, opts ...server.SubscriberOptio func (g *Server) createSubHandler(sb *subscriber, opts server.Options) broker.Handler { return func(p broker.Event) (err error) { - defer func() { - if r := recover(); r != nil { - if g.opts.Logger.V(logger.ErrorLevel) { - g.opts.Logger.Error(g.opts.Context, "panic recovered: ", r) - g.opts.Logger.Error(g.opts.Context, string(debug.Stack())) - } - err = errors.InternalServerError(g.opts.Name+".subscriber", "panic recovered: %v", r) - } - }() msg := p.Message() // if we don't have headers, create empty map