kata-containers/runtime/patches/0003-kata-runtime-fix-kata-proxy-process-left-problem.patch
holyfei c709612f2a kata-containers: modify kata-containers version
Fix #I4KI81
reason: modify kata-containers version and update
it to 1.11.1

Signed-off-by: holyfei <yangfeiyu20092010@163.com>
2021-11-30 20:08:25 +08:00

56 lines
1.7 KiB
Diff

From cf595941e1d105af23bc006bf1998ac072733d0a Mon Sep 17 00:00:00 2001
From: jiangpengfei <jiangpengfei9@huawei.com>
Date: Sat, 25 Jul 2020 10:03:35 +0800
Subject: [PATCH 03/50] kata-runtime: fix kata-proxy process left problem
reason: stopSandbox function will send the DestroySandboxRequest
to kata-agent in the VM and then kill the kata-proxy process in
the host. However, if k.sendReq(DestroySandboxRequest) get error,
stopSandbox will return immediately not execute the following kill
kata-proxy process statement, which cause the kata-process left.
Signed-off-by: jiangpengfei <jiangpengfei9@huawei.com>
---
virtcontainers/kata_agent.go | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/virtcontainers/kata_agent.go b/virtcontainers/kata_agent.go
index a0cf190e..be5e96aa 100644
--- a/virtcontainers/kata_agent.go
+++ b/virtcontainers/kata_agent.go
@@ -976,6 +976,17 @@ func (k *kataAgent) stopSandbox(sandbox *Sandbox) error {
return errorMissingProxy
}
+ // since stopSandbox will destroy the sandbox in the VM, and we don't need
+ // kata-proxy process to communicate with kata-agent again, so we should
+ // make sure kata-proxy can be killed cleanly, even when k.sendReq(DestroySandboxRequest)
+ // return error
+ defer func() {
+ _ = k.proxy.stop(k.state.ProxyPid)
+ // clean up agent state
+ k.state.ProxyPid = -1
+ k.state.URL = ""
+ }()
+
req := &grpc.DestroySandboxRequest{}
if _, err := k.sendReq(req); err != nil {
@@ -989,13 +1000,6 @@ func (k *kataAgent) stopSandbox(sandbox *Sandbox) error {
}
}
- if err := k.proxy.stop(k.state.ProxyPid); err != nil {
- return err
- }
-
- // clean up agent state
- k.state.ProxyPid = -1
- k.state.URL = ""
return nil
}
--
2.14.3 (Apple Git-98)