From 2d350366b7e9a291b49b25cbdcdbdaae1e9ebb8c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 18 Jul 2023 12:03:45 +0800 Subject: [PATCH] debug: print stack --- internal/rpc/msg/server.go | 2 -- internal/rpc/msg/lock.go => pkg/common/locker/message_locker.go | 2 +- pkg/common/mw/rpc_client_interceptor.go | 2 ++ pkg/common/mw/rpc_server_interceptor.go | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) rename internal/rpc/msg/lock.go => pkg/common/locker/message_locker.go (99%) diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 5e2cf925f..e88d55bd1 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -42,7 +42,6 @@ type ( friend *rpcclient.FriendRpcClient GroupLocalCache *localcache.GroupLocalCache ConversationLocalCache *localcache.ConversationLocalCache - MessageLocker MessageLocker Handlers MessageInterceptorChain notificationSender *rpcclient.NotificationSender } @@ -91,7 +90,6 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e GroupLocalCache: localcache.NewGroupLocalCache(&groupRpcClient), ConversationLocalCache: localcache.NewConversationLocalCache(&conversationClient), friend: &friendRpcClient, - MessageLocker: NewLockerMessage(cacheModel), } s.notificationSender = rpcclient.NewNotificationSender(rpcclient.WithLocalSendMsg(s.SendMsg)) s.addInterceptorHandler(MessageHasReadEnabled) diff --git a/internal/rpc/msg/lock.go b/pkg/common/locker/message_locker.go similarity index 99% rename from internal/rpc/msg/lock.go rename to pkg/common/locker/message_locker.go index 154a5b181..2631f19b1 100644 --- a/internal/rpc/msg/lock.go +++ b/pkg/common/locker/message_locker.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package msg +package locker import ( "context" diff --git a/pkg/common/mw/rpc_client_interceptor.go b/pkg/common/mw/rpc_client_interceptor.go index 91a166c32..ff6396798 100644 --- a/pkg/common/mw/rpc_client_interceptor.go +++ b/pkg/common/mw/rpc_client_interceptor.go @@ -18,6 +18,7 @@ import ( "context" "errors" "fmt" + "runtime/debug" "strings" "google.golang.org/grpc" @@ -31,6 +32,7 @@ import ( ) func GrpcClient() grpc.DialOption { + fmt.Println("grpc client interceptor", "stack", string(debug.Stack())) return grpc.WithChainUnaryInterceptor(RpcClientInterceptor) } diff --git a/pkg/common/mw/rpc_server_interceptor.go b/pkg/common/mw/rpc_server_interceptor.go index ec43069da..23eea4ee3 100644 --- a/pkg/common/mw/rpc_server_interceptor.go +++ b/pkg/common/mw/rpc_server_interceptor.go @@ -19,6 +19,7 @@ import ( "fmt" "math" "runtime" + "runtime/debug" "strings" "github.com/OpenIMSDK/Open-IM-Server/pkg/checker" @@ -177,5 +178,6 @@ func RpcServerInterceptor( } func GrpcServer() grpc.ServerOption { + fmt.Println("grpc server interceptor", "stack", string(debug.Stack())) return grpc.ChainUnaryInterceptor(RpcServerInterceptor) }