fix(container): Fix cpu surge when the container terminal executes exit#8115
fix(container): Fix cpu surge when the container terminal executes exit#8115wanghe-fit2cloud merged 1 commit intodevfrom
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| setQuit(exitCh) | ||
| global.LOG.Errorf("A panic occurred during receive ws message, error message: %v", r) | ||
| } | ||
| }() |
There was a problem hiding this comment.
The receiveWsMsg function has an issue with handling panics. The comment line about setting a quit channel (setQuit(exitCh) ) should be inside the deferred recovery block to ensure it is executed even if an error occurs within the recovery logic itself.
Modified Function:
func (sws *LocalWsSession) receiveWsMsg(exitCh chan bool) {
defer func() {
var recoverError interface{}
if r = recover(); r != nil || recoverError = r.(type); recoverr{
setQuit(exitCh)
global.LOG.Errorf("A panic occurred during receive ws message, error message: %v", r)
}
}()
}This change will prevent any unintended errors during recovery from halting the execution of other critical operations. Additionally, using a type cast helps safely access the recovered value when a runtime error occurs.
|



No description provided.