diff --git a/backend/utils/terminal/ws_local_session.go b/backend/utils/terminal/ws_local_session.go index cc5aa6c61..fb8271994 100644 --- a/backend/utils/terminal/ws_local_session.go +++ b/backend/utils/terminal/ws_local_session.go @@ -70,6 +70,11 @@ func (sws *LocalWsSession) masterWrite(data []byte) error { } func (sws *LocalWsSession) receiveWsMsg(exitCh chan bool) { + defer func() { + if r := recover(); r != nil { + global.LOG.Errorf("[xpack] A panic occurred during receive ws message, error message: %v", r) + } + }() wsConn := sws.wsConn defer setQuit(exitCh) defer global.LOG.Debug("thread of receive ws msg has exited now") diff --git a/backend/utils/terminal/ws_session.go b/backend/utils/terminal/ws_session.go index 7c30c65ab..c0e72a761 100644 --- a/backend/utils/terminal/ws_session.go +++ b/backend/utils/terminal/ws_session.go @@ -116,6 +116,11 @@ func (sws *LogicSshWsSession) Start(quitChan chan bool) { } func (sws *LogicSshWsSession) receiveWsMsg(exitCh chan bool) { + defer func() { + if r := recover(); r != nil { + global.LOG.Errorf("[xpack] A panic occurred during receive ws message, error message: %v", r) + } + }() wsConn := sws.wsConn defer setQuit(exitCh) for {