Skip to content

Commit 7cfbb0f

Browse files
committed
fix: fix the issue which the server-side did not report failure after a panic occurred during request processing
1 parent ad5b40a commit 7cfbb0f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/remote/trans/default_server_handler.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,9 @@ func (t *svrTransHandler) OnRead(ctx context.Context, conn net.Conn) (err error)
144144
} else {
145145
klog.CtxErrorf(ctx, "KITEX: panic happened, error=%v\nstack=%s", panicErr, stack)
146146
}
147-
if err != nil {
148-
wrapErr = kerrors.ErrPanic.WithCauseAndStack(fmt.Errorf("[happened in OnRead] %s, last error=%s", panicErr, err.Error()), stack)
149-
} else {
150-
wrapErr = kerrors.ErrPanic.WithCauseAndStack(fmt.Errorf("[happened in OnRead] %s", panicErr), stack)
147+
if err == nil {
151148
// if err is nil, set err as panic wrapErr
149+
wrapErr = kerrors.ErrPanic.WithCauseAndStack(fmt.Errorf("[happened in OnRead] %s", panicErr), stack)
152150
err = remote.NewTransError(remote.InternalError, wrapErr)
153151
t.writeErrorReplyIfNeeded(ctx, recvMsg, conn, err, ri, true)
154152
}

0 commit comments

Comments
 (0)