代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/kubernetes 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 760129610e5b54d548247490899a8595cea2d5b8 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <[email protected]>
Date: Mon, 31 Oct 2022 17:15:51 +0800
Subject: [PATCH] kubelet fix websocket reference nul pointer
Signed-off-by: zhangxiaoyu <[email protected]>
---
.../cri/streaming/remotecommand/proxy.go | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/pkg/kubelet/cri/streaming/remotecommand/proxy.go b/pkg/kubelet/cri/streaming/remotecommand/proxy.go
index 76222d90..f21629af 100644
--- a/pkg/kubelet/cri/streaming/remotecommand/proxy.go
+++ b/pkg/kubelet/cri/streaming/remotecommand/proxy.go
@@ -169,14 +169,23 @@ func connectBackend(addr, subprotocol string, r *http.Request) (*websocket.Conn,
websocket.DefaultDialer.ReadBufferSize = 128 * 1024
websocket.DefaultDialer.WriteBufferSize = 128 * 1024
ws, resp, err := websocket.DefaultDialer.Dial(addr, h)
- if err != nil {
+ if err == nil {
+ return ws, nil
+ }
+ msg := fmt.Errorf("dial failed: %v, response Body is nil", err)
+ if resp != nil && resp.Body != nil {
+ defer func() {
+ //websocket buffer size maybe not enough and cause panic
+ if e := recover(); e != nil {
+ msg = fmt.Errorf("dial failed: %v, response panic %v", err, e)
+ }
+ resp.Body.Close()
+ }()
var body bytes.Buffer
body.ReadFrom(resp.Body)
- defer resp.Body.Close()
- msg := fmt.Errorf("dial failed: %v, response is: %v", err, body.String())
- return nil, msg
+ msg = fmt.Errorf("dial failed: %v, response is: %v", err, body.String())
}
- return ws, nil
+ return nil, msg
}
type rwc struct {
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。