diff --git a/pkg/common/mw/rpc_server_interceptor.go b/pkg/common/mw/rpc_server_interceptor.go index c416c584e..61b3efe57 100644 --- a/pkg/common/mw/rpc_server_interceptor.go +++ b/pkg/common/mw/rpc_server_interceptor.go @@ -5,7 +5,6 @@ import ( "fmt" "math" "runtime" - "runtime/debug" "strings" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant" @@ -30,28 +29,28 @@ func rpcString(v interface{}) string { } func RpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) { - defer func() { - if r := recover(); r != nil { - log.ZError(ctx, "rpc panic", nil, "FullMethod", info.FullMethod, "type:", fmt.Sprintf("%T", r), "panic:", r) - fmt.Printf("panic: %+v\nstack info: %s\n", r, string(debug.Stack())) - pc, file, line, ok := runtime.Caller(4) - if !ok { - panic("get runtime.Caller failed") - } - errInfo := &errinfo.ErrorInfo{ - Path: file, - Line: uint32(line), - Name: runtime.FuncForPC(pc).Name(), - Cause: fmt.Sprintf("%s", r), - Warp: nil, - } - sta, err_ := status.New(codes.Code(errs.ErrInternalServer.Code()), errs.ErrInternalServer.Msg()).WithDetails(errInfo) - if err_ != nil { - panic(err_) - } - err = sta.Err() - } - }() + //defer func() { + // if r := recover(); r != nil { + // log.ZError(ctx, "rpc panic", nil, "FullMethod", info.FullMethod, "type:", fmt.Sprintf("%T", r), "panic:", r) + // fmt.Printf("panic: %+v\nstack info: %s\n", r, string(debug.Stack())) + // pc, file, line, ok := runtime.Caller(4) + // if !ok { + // panic("get runtime.Caller failed") + // } + // errInfo := &errinfo.ErrorInfo{ + // Path: file, + // Line: uint32(line), + // Name: runtime.FuncForPC(pc).Name(), + // Cause: fmt.Sprintf("%s", r), + // Warp: nil, + // } + // sta, err_ := status.New(codes.Code(errs.ErrInternalServer.Code()), errs.ErrInternalServer.Msg()).WithDetails(errInfo) + // if err_ != nil { + // panic(err_) + // } + // err = sta.Err() + // } + //}() funcName := info.FullMethod md, ok := metadata.FromIncomingContext(ctx) if !ok {