From 159a4f423f514f010fdd20bba9f6a2b8dfe8e5af Mon Sep 17 00:00:00 2001 From: zhongjiawei Date: Sat, 31 Aug 2024 09:38:33 +0800 Subject: [PATCH] docker:try to reconnect when containerd grpc return unexpected EOF (cherry picked from commit bb19128a08aa2355d23555925a14a3733d173b64) --- VERSION-vendor | 2 +- docker.spec | 8 ++- git-commit | 2 +- ...connect-when-containerd-grpc-return-.patch | 57 +++++++++++++++++++ series.conf | 1 + 5 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 patch/0279-docker-try-to-reconnect-when-containerd-grpc-return-.patch diff --git a/VERSION-vendor b/VERSION-vendor index ce0f4a7..9007bda 100644 --- a/VERSION-vendor +++ b/VERSION-vendor @@ -1 +1 @@ -18.09.0.340 +18.09.0.341 diff --git a/docker.spec b/docker.spec index 52b693b..64db0ff 100644 --- a/docker.spec +++ b/docker.spec @@ -1,6 +1,6 @@ Name: docker-engine Version: 18.09.0 -Release: 340 +Release: 341 Epoch: 2 Summary: The open-source application container engine Group: Tools/Docker @@ -227,6 +227,12 @@ fi %endif %changelog +* Sat Aug 31 2024 zhongjiawei - 2:18.09.0-341 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:try to reconnect when containerd grpc return unexpected EOF + * Fri Aug 02 2024 zhongjiawei - 2:18.09.0-340 - Type:bugfix - CVE:NA diff --git a/git-commit b/git-commit index 10194d5..0fc7236 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -29173030b7e118013ed3e8a3773492c40928bb9c +678fb4d2b2fbf91642358d82e5680aec01a15d56 diff --git a/patch/0279-docker-try-to-reconnect-when-containerd-grpc-return-.patch b/patch/0279-docker-try-to-reconnect-when-containerd-grpc-return-.patch new file mode 100644 index 0000000..c3c84e2 --- /dev/null +++ b/patch/0279-docker-try-to-reconnect-when-containerd-grpc-return-.patch @@ -0,0 +1,57 @@ +From 68ea83ecea0e38d084c0d15c9e99c0b4494b1f32 Mon Sep 17 00:00:00 2001 +From: zhongjiawei +Date: Thu, 22 Aug 2024 20:22:43 +0800 +Subject: [PATCH] docker: try to reconnect when containerd grpc return + unexpected EOF + +--- + .../engine/libcontainerd/client_daemon.go | 26 ++++++++++++++----- + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/components/engine/libcontainerd/client_daemon.go b/components/engine/libcontainerd/client_daemon.go +index 09ce6e1f5..14f420ed8 100755 +--- a/components/engine/libcontainerd/client_daemon.go ++++ b/components/engine/libcontainerd/client_daemon.go +@@ -38,9 +38,12 @@ import ( + "google.golang.org/grpc/status" + ) + +-// InitProcessName is the name given to the first process of a +-// container +-const InitProcessName = "init" ++const ( ++ // InitProcessName is the name given to the first process of a container ++ InitProcessName = "init" ++ // RetryMax is the max num to connect containerd grpc ++ RetryMax = 10 ++) + + type container struct { + mu sync.Mutex +@@ -167,9 +170,20 @@ func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallba + err = wrapError(err) + }() + +- ctr, err := c.client.LoadContainer(ctx, id) +- if err != nil { +- return false, -1, errors.WithStack(wrapError(err)) ++ var ctr containerd.Container ++ var err1 error ++ for retry := 1; retry <= RetryMax; retry++ { ++ ctr, err1 = c.client.LoadContainer(ctx, id) ++ if err1 == nil { ++ break ++ } else if strings.Contains(err1.Error(), "unexpected EOF") { ++ time.Sleep(time.Millisecond * 100) ++ continue ++ } ++ return false, -1, errors.WithStack(wrapError(err1)) ++ } ++ if err1 != nil { ++ return false, -1, errors.Wrap(wrapError(err1), "reconnect load contianer failed") + } + + attachIO := func(fifos *cio.FIFOSet) (cio.IO, error) { +-- +2.33.0 + diff --git a/series.conf b/series.conf index df25d03..dc53d1f 100644 --- a/series.conf +++ b/series.conf @@ -276,4 +276,5 @@ patch/0275-backport-fix-CVE-2024-32473.patch patch/0276-docker-Ignore-SIGURG-on-Linux.patch patch/0277-backport-fix-CVE-2024-41110.patch patch/0278-docker-add-clone3-seccomp-whitelist-for-arm64.patch +patch/0279-docker-try-to-reconnect-when-containerd-grpc-return-.patch #end -- Gitee