Skip to content

Commit 92ea52f

Browse files
authored
fix:Only print panic function frame && feat: log.ZPanic (#2947)
* fix: log print panic * Merge: main
1 parent 120afdf commit 92ea52f

File tree

7 files changed

+10
-13
lines changed

7 files changed

+10
-13
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
1616
github.com/mitchellh/mapstructure v1.5.0
1717
github.com/openimsdk/protocol v0.0.72-alpha.63
18-
github.com/openimsdk/tools v0.0.50-alpha.47
18+
github.com/openimsdk/tools v0.0.50-alpha.50
1919
github.com/pkg/errors v0.9.1 // indirect
2020
github.com/prometheus/client_golang v1.18.0
2121
github.com/stretchr/testify v1.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ github.com/openimsdk/gomake v0.0.15-alpha.2 h1:5Q8yl8ezy2yx+q8/ucU/t4kJnDfCzNOrk
349349
github.com/openimsdk/gomake v0.0.15-alpha.2/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
350350
github.com/openimsdk/protocol v0.0.72-alpha.63 h1:IyPBibEvwBtTmD8DSrlqcekfEXe74k4+KeeHsgdhGh0=
351351
github.com/openimsdk/protocol v0.0.72-alpha.63/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
352-
github.com/openimsdk/tools v0.0.50-alpha.47 h1:Cfe2va/g6WhLjOoQqZkjrdlEDq1dUsfcQsdUB5oADVA=
353-
github.com/openimsdk/tools v0.0.50-alpha.47/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
352+
github.com/openimsdk/tools v0.0.50-alpha.50 h1:+naDlvHcqJDj2NsCGnQd1LLQOET5IRPbrtmWbM/o7JQ=
353+
github.com/openimsdk/tools v0.0.50-alpha.50/go.mod h1:muCtxguNJv8lFwLei27UASu2Nvg4ERSeN0R4K5tivk0=
354354
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
355355
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
356356
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=

internal/msggateway/client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"context"
1919
"encoding/json"
2020
"fmt"
21-
"github.com/openimsdk/tools/mw"
2221
"runtime/debug"
2322
"sync"
2423
"sync/atomic"
@@ -378,7 +377,7 @@ func (c *Client) activeHeartbeat(ctx context.Context) {
378377
go func() {
379378
defer func() {
380379
if r := recover(); r != nil {
381-
mw.PanicStackToLog(ctx, r)
380+
log.ZPanic(ctx, "activeHeartbeat Panic", r)
382381
}
383382
}()
384383
log.ZDebug(ctx, "server initiative send heartbeat start.")

internal/msgtransfer/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func (m *MsgTransfer) Start(index int, config *Config) error {
204204
go func() {
205205
defer func() {
206206
if r := recover(); r != nil {
207-
mw.PanicStackToLog(m.ctx, r)
207+
log.ZPanic(m.ctx, "MsgTransfer Start Panic", r)
208208
}
209209
}()
210210
if err := prommetrics.TransferInit(listener); err != nil && !errors.Is(err, http.ErrServerClosed) {

internal/msgtransfer/online_history_msg_handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import (
1818
"context"
1919
"encoding/json"
2020
"errors"
21-
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
22-
"github.com/openimsdk/tools/mw"
2321
"strconv"
2422
"strings"
2523
"sync"
2624
"time"
2725

26+
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
27+
2828
"github.com/IBM/sarama"
2929
"github.com/go-redis/redis"
3030
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
@@ -349,7 +349,7 @@ func (och *OnlineHistoryRedisConsumerHandler) handleNotification(ctx context.Con
349349
func (och *OnlineHistoryRedisConsumerHandler) HandleUserHasReadSeqMessages(ctx context.Context) {
350350
defer func() {
351351
if r := recover(); r != nil {
352-
mw.PanicStackToLog(ctx, r)
352+
log.ZPanic(ctx, "HandleUserHasReadSeqMessages Panic", r)
353353
}
354354
}()
355355

internal/rpc/msg/send.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package msg
1616

1717
import (
1818
"context"
19-
"github.com/openimsdk/tools/mw"
2019

2120
"github.com/openimsdk/open-im-server/v3/pkg/common/prommetrics"
2221
"github.com/openimsdk/open-im-server/v3/pkg/msgprocessor"
@@ -89,7 +88,7 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
8988

9089
defer func() {
9190
if r := recover(); r != nil {
92-
mw.PanicStackToLog(nctx, r)
91+
log.ZPanic(nctx, "setConversationAtInfo Panic", r)
9392
}
9493
}()
9594

pkg/rpccache/subscriber.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package rpccache
1717
import (
1818
"context"
1919
"encoding/json"
20-
"github.com/openimsdk/tools/mw"
2120

2221
"github.com/openimsdk/tools/log"
2322
"github.com/redis/go-redis/v9"
@@ -26,7 +25,7 @@ import (
2625
func subscriberRedisDeleteCache(ctx context.Context, client redis.UniversalClient, channel string, del func(ctx context.Context, key ...string)) {
2726
defer func() {
2827
if r := recover(); r != nil {
29-
mw.PanicStackToLog(ctx, r)
28+
log.ZPanic(ctx, "subscriberRedisDeleteCache Panic", r)
3029
}
3130
}()
3231
for message := range client.Subscribe(ctx, channel).Channel() {

0 commit comments

Comments
 (0)