diff --git a/apply-patches b/apply-patches deleted file mode 100644 index 325c2c0255c4581ecc80508e6af26bdc089011c9..0000000000000000000000000000000000000000 --- a/apply-patches +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Description: This shell script is used to apply patches for the project -# Author: zhangzhihui@xfusion.com -# Create: 2023-03-27 - -set -ex - -pkg=moby-20.10.24 -cwd=$PWD -src=$cwd/$pkg - -if [ ! -d patch ];then - tar -xzf patch.tar.gz -fi - -cd $src -git init -git add . -git config user.name 'build' -git config user.email 'build@obs.com' -git commit -m "init build" -cd $cwd - -series=$cwd/series.conf -while IPF=read -r line -do - if [[ "$line" =~ ^patch* ]];then - echo git apply $cwd/$line - cd $src && git apply $cwd/$line - fi -done < "$series" - -mv $src/.git $src/git diff --git a/awslogs-fix-non-blocking-log-drop-bug.patch b/awslogs-fix-non-blocking-log-drop-bug.patch new file mode 100644 index 0000000000000000000000000000000000000000..f2539a5e550071065c60e17c0e240d205e642ef9 --- /dev/null +++ b/awslogs-fix-non-blocking-log-drop-bug.patch @@ -0,0 +1,149 @@ +From ad45ece6fe93c6870080341daa12fe8da6271fa9 Mon Sep 17 00:00:00 2001 +From: Wesley Pettit +Date: Wed, 29 Mar 2023 16:09:07 -0700 +Subject: [PATCH 451/483] awslogs: fix non-blocking log drop bug + +Previously, the AWSLogs driver attempted to implement +non-blocking itself. Non-blocking is supposed to +implemented solely by the Docker RingBuffer that +wraps the log driver. + +Please see issue and explanation here: +https://github.com/moby/moby/issues/45217 + +Signed-off-by: Wesley Pettit +(cherry picked from commit c8f8d11ac42c16be9779565093e6a45bcf1a3b7b) +--- + daemon/logger/awslogs/cloudwatchlogs.go | 18 ++--------- + daemon/logger/awslogs/cloudwatchlogs_test.go | 32 ++------------------ + 2 files changed, 6 insertions(+), 44 deletions(-) + +diff --git a/daemon/logger/awslogs/cloudwatchlogs.go b/daemon/logger/awslogs/cloudwatchlogs.go +index acaf261c93..5ceb0c913f 100644 +--- a/daemon/logger/awslogs/cloudwatchlogs.go ++++ b/daemon/logger/awslogs/cloudwatchlogs.go +@@ -71,7 +71,6 @@ type logStream struct { + logStreamName string + logGroupName string + logCreateGroup bool +- logNonBlocking bool + forceFlushInterval time.Duration + multilinePattern *regexp.Regexp + client api +@@ -85,7 +84,6 @@ type logStreamConfig struct { + logStreamName string + logGroupName string + logCreateGroup bool +- logNonBlocking bool + forceFlushInterval time.Duration + maxBufferedEvents int + multilinePattern *regexp.Regexp +@@ -147,11 +145,12 @@ func New(info logger.Info) (logger.Logger, error) { + return nil, err + } + ++ logNonBlocking := info.Config["mode"] == "non-blocking" ++ + containerStream := &logStream{ + logStreamName: containerStreamConfig.logStreamName, + logGroupName: containerStreamConfig.logGroupName, + logCreateGroup: containerStreamConfig.logCreateGroup, +- logNonBlocking: containerStreamConfig.logNonBlocking, + forceFlushInterval: containerStreamConfig.forceFlushInterval, + multilinePattern: containerStreamConfig.multilinePattern, + client: client, +@@ -159,7 +158,7 @@ func New(info logger.Info) (logger.Logger, error) { + } + + creationDone := make(chan bool) +- if containerStream.logNonBlocking { ++ if logNonBlocking { + go func() { + backoff := 1 + maxBackoff := 32 +@@ -215,8 +214,6 @@ func newStreamConfig(info logger.Info) (*logStreamConfig, error) { + } + } + +- logNonBlocking := info.Config["mode"] == "non-blocking" +- + forceFlushInterval := defaultForceFlushInterval + if info.Config[forceFlushIntervalKey] != "" { + forceFlushIntervalAsInt, err := strconv.Atoi(info.Config[forceFlushIntervalKey]) +@@ -247,7 +244,6 @@ func newStreamConfig(info logger.Info) (*logStreamConfig, error) { + logStreamName: logStreamName, + logGroupName: logGroupName, + logCreateGroup: logCreateGroup, +- logNonBlocking: logNonBlocking, + forceFlushInterval: forceFlushInterval, + maxBufferedEvents: maxBufferedEvents, + multilinePattern: multilinePattern, +@@ -412,14 +408,6 @@ func (l *logStream) Log(msg *logger.Message) error { + if l.closed { + return errors.New("awslogs is closed") + } +- if l.logNonBlocking { +- select { +- case l.messages <- msg: +- return nil +- default: +- return errors.New("awslogs buffer is full") +- } +- } + l.messages <- msg + return nil + } +diff --git a/daemon/logger/awslogs/cloudwatchlogs_test.go b/daemon/logger/awslogs/cloudwatchlogs_test.go +index 688a3b5e2f..c5a0788303 100644 +--- a/daemon/logger/awslogs/cloudwatchlogs_test.go ++++ b/daemon/logger/awslogs/cloudwatchlogs_test.go +@@ -325,42 +325,16 @@ func TestLogBlocking(t *testing.T) { + } + } + +-func TestLogNonBlockingBufferEmpty(t *testing.T) { ++func TestLogBufferEmpty(t *testing.T) { + mockClient := newMockClient() + stream := &logStream{ +- client: mockClient, +- messages: make(chan *logger.Message, 1), +- logNonBlocking: true, ++ client: mockClient, ++ messages: make(chan *logger.Message, 1), + } + err := stream.Log(&logger.Message{}) + assert.NilError(t, err) + } + +-func TestLogNonBlockingBufferFull(t *testing.T) { +- mockClient := newMockClient() +- stream := &logStream{ +- client: mockClient, +- messages: make(chan *logger.Message, 1), +- logNonBlocking: true, +- } +- stream.messages <- &logger.Message{} +- errorCh := make(chan error, 1) +- started := make(chan bool) +- go func() { +- started <- true +- err := stream.Log(&logger.Message{}) +- errorCh <- err +- }() +- <-started +- select { +- case err := <-errorCh: +- if err == nil { +- t.Fatal("Expected non-nil error") +- } +- case <-time.After(30 * time.Second): +- t.Fatal("Expected Log call to not block") +- } +-} + func TestPublishBatchSuccess(t *testing.T) { + mockClient := newMockClient() + stream := &logStream{ +-- +2.32.0 (Apple Git-132) + + diff --git a/daemon-prepare-MountPoints-fix-panic-if-mount.patch b/daemon-prepare-MountPoints-fix-panic-if-mount.patch new file mode 100644 index 0000000000000000000000000000000000000000..90b7e00b4c879b8b4dd69cca133118fb53ed58f8 --- /dev/null +++ b/daemon-prepare-MountPoints-fix-panic-if-mount.patch @@ -0,0 +1,54 @@ +From 44152f6fb66da0ade1aa226f0b66ebbaa43d54b1 Mon Sep 17 00:00:00 2001 +From: Sebastiaan van Stijn +Date: Fri, 7 Jul 2023 14:54:04 +0200 +Subject: [PATCH 478/483] daemon: daemon.prepareMountPoints(): fix panic if + mount is not a volume + +The daemon.lazyInitializeVolume() function only handles restoring Volumes +if a Driver is specified. The Container's MountPoints field may also +contain other kind of mounts (e.g., bind-mounts). Those were ignored, and +don't return an error; https://github.com/moby/moby/blob/1d9c8619cded4657af1529779c5771127e8ad0e7/daemon/volumes.go#L243-L252C2 + +However, the prepareMountPoints() assumed each MountPoint was a volume, +and logged an informational message about the volume being restored; +https://github.com/moby/moby/blob/1d9c8619cded4657af1529779c5771127e8ad0e7/daemon/mounts.go#L18-L25 + +This would panic if the MountPoint was not a volume; + + github.com/docker/docker/daemon.(*Daemon).prepareMountPoints(0xc00054b7b8?, 0xc0007c2500) + /root/rpmbuild/BUILD/src/engine/.gopath/src/github.com/docker/docker/daemon/mounts.go:24 +0x1c0 + github.com/docker/docker/daemon.(*Daemon).restore.func5(0xc0007c2500, 0x0?) + /root/rpmbuild/BUILD/src/engine/.gopath/src/github.com/docker/docker/daemon/daemon.go:552 +0x271 + created by github.com/docker/docker/daemon.(*Daemon).restore + /root/rpmbuild/BUILD/src/engine/.gopath/src/github.com/docker/docker/daemon/daemon.go:530 +0x8d8 + panic: runtime error: invalid memory address or nil pointer dereference + [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x564e9be4c7c0] + +This issue was introduced in 647c2a6cdd86d79230df1bf690d0b6a2930d6db2 + +Signed-off-by: Sebastiaan van Stijn +(cherry picked from commit a490248f4d19164d78d3ef4f91cf142c3aad1790) +Signed-off-by: Cory Snider +--- + daemon/mounts.go | 4 ++++ + 1 files changed, 4 insertions(+) + +diff --git a/daemon/mounts.go b/daemon/mounts.go +index 424e375037..3c79b0d447 100644 +--- a/daemon/mounts.go ++++ b/daemon/mounts.go +@@ -15,6 +15,10 @@ func (daemon *Daemon) prepareMountPoints(container *container.Container) error { + if err := daemon.lazyInitializeVolume(container.ID, config); err != nil { + return err + } ++ if config.Volume == nil { ++ // FIXME(thaJeztah): should we check for config.Type here as well? (i.e., skip bind-mounts etc) ++ continue ++ } + } + return nil + } +-- +2.32.0 (Apple Git-132) + + diff --git a/libnetwork-dcdf8f17.tar.gz b/libnetwork-dcdf8f17.tar.gz deleted file mode 100644 index f6c37a44c86497323fb2373a55d5c77cdc204c17..0000000000000000000000000000000000000000 Binary files a/libnetwork-dcdf8f17.tar.gz and /dev/null differ diff --git a/moby.spec b/moby.spec index da911107fdabbd420adf964f48bf9692bff61b5d..0dc4036cb6e85c66340de765ca47af205f42e8a3 100644 --- a/moby.spec +++ b/moby.spec @@ -7,7 +7,7 @@ Name: moby Version: 20.10.24 -Release: 5 +Release: 6 Summary: The open-source application container engine License: ASL 2.0 URL: https://www.docker.com @@ -20,9 +20,8 @@ Source2: tini-0.19.0.tar.gz Source3: docker.service Source4: docker.socket Source5: docker.sysconfig -Source6: apply-patches -Source7: series.conf -Source8: patch.tar.gz +Patch0000: awslogs-fix-non-blocking-log-drop-bug.patch +Patch0001: daemon-prepare-MountPoints-fix-panic-if-mount.patch Requires: %{name}-engine = %{version}-%{release} @@ -92,15 +91,10 @@ Docker client binary and related utilities %prep %setup -q -n %{_source_client} %setup -q -T -n %{_source_engine} -b 1 +%patch0000 -p1 +%patch0001 -p1 %setup -q -T -n %{_source_docker_init} -b 2 -cd %{_builddir} -cp %{SOURCE6} . -cp %{SOURCE7} . -cp %{SOURCE8} . - -sh ./apply-patches - %build export GO111MODULE=off # build docker daemon @@ -200,6 +194,9 @@ fi %systemd_postun_with_restart docker.service %changelog +* Mon Sep 18 2023 xulei - 20.10.24-6 +- Optimize the apply patch method + * Thu Sep 14 2023 xulei - 20.10.24-5 - DESC: Fix missing runc dependencies The declaration conflicts with the installation of docker-engine diff --git a/patch.tar.gz b/patch.tar.gz deleted file mode 100644 index f5ed7e1007dbf420e5ca9477f1ff69d028ebe0c5..0000000000000000000000000000000000000000 Binary files a/patch.tar.gz and /dev/null differ diff --git a/series.conf b/series.conf deleted file mode 100644 index f5beaceb137dfac4848be1e04565e8e5f4b2f0e8..0000000000000000000000000000000000000000 --- a/series.conf +++ /dev/null @@ -1,2 +0,0 @@ -patch/0001-awslogs-fix-non-blocking-log-drop-bug.patch -patch/0002-daemon-daemon.prepareMountPoints-fix-panic-if-mount-.patch