close channel in write side to avoid panic in docker stats
fix #I5ATMV (cherry picked from commit e30932844aeb7d94b6ec1491e63acb0d1a9a2b1a)
This commit is contained in:
parent
95a9037aa0
commit
f8ffee8d73
@ -1 +1 @@
|
|||||||
18.09.0.234
|
18.09.0.235
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
Name: docker-engine
|
Name: docker-engine
|
||||||
Version: 18.09.0
|
Version: 18.09.0
|
||||||
Release: 234
|
Release: 235
|
||||||
Summary: The open-source application container engine
|
Summary: The open-source application container engine
|
||||||
Group: Tools/Docker
|
Group: Tools/Docker
|
||||||
|
|
||||||
@ -198,6 +198,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 28 2022 chenjiankun <chenjiankun1@huawei.com> - 18.09.0-235
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:close channel in write side to avoid panic in docker stats
|
||||||
|
|
||||||
* Thu Jun 28 2022 chenjiankun <chenjiankun1@huawei.com> - 18.09.0-234
|
* Thu Jun 28 2022 chenjiankun <chenjiankun1@huawei.com> - 18.09.0-234
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
From 548078b9e76e34c6994830ce35bee1c15e3c091f Mon Sep 17 00:00:00 2001
|
||||||
|
From: chenjiankun <chenjiankun1@huawei.com>
|
||||||
|
Date: Mon, 21 Mar 2022 11:05:43 +0800
|
||||||
|
Subject: [PATCH] docker: close channel in write side to avoid panic in docker
|
||||||
|
stats
|
||||||
|
|
||||||
|
there is a situation when write event to chan c, chan c is close,
|
||||||
|
and that will cause a panic. Close chan c in write side can avaid
|
||||||
|
panic.
|
||||||
|
---
|
||||||
|
components/cli/cli/command/container/stats.go | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/components/cli/cli/command/container/stats.go b/components/cli/cli/command/container/stats.go
|
||||||
|
index 8387fc988..daab91627 100644
|
||||||
|
--- a/components/cli/cli/command/container/stats.go
|
||||||
|
+++ b/components/cli/cli/command/container/stats.go
|
||||||
|
@@ -60,6 +60,9 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
|
// monitorContainerEvents watches for container creation and removal (only
|
||||||
|
// used when calling `docker stats` without arguments).
|
||||||
|
monitorContainerEvents := func(started chan<- struct{}, c chan events.Message) {
|
||||||
|
+ // close channel in write side to avoid panic
|
||||||
|
+ defer close(c)
|
||||||
|
+
|
||||||
|
f := filters.NewArgs()
|
||||||
|
f.Add("type", "container")
|
||||||
|
options := types.EventsOptions{
|
||||||
|
@@ -150,7 +153,6 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
|
eventChan := make(chan events.Message)
|
||||||
|
go eh.Watch(eventChan)
|
||||||
|
go monitorContainerEvents(started, eventChan)
|
||||||
|
- defer close(eventChan)
|
||||||
|
<-started
|
||||||
|
|
||||||
|
// Start a short-lived goroutine to retrieve the initial list of
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -217,4 +217,5 @@ patch/0220-docker-fix-endpoint-with-name-container_xx-already-e.patch
|
|||||||
patch/0221-docker-fix-Up-292-years-in-status-in-docker-ps-a.patch
|
patch/0221-docker-fix-Up-292-years-in-status-in-docker-ps-a.patch
|
||||||
patch/0222-docker-fix-CVE-2022-24769.patch
|
patch/0222-docker-fix-CVE-2022-24769.patch
|
||||||
patch/0223-fix-rwlayer-umountd-after-container-restart.patch
|
patch/0223-fix-rwlayer-umountd-after-container-restart.patch
|
||||||
|
patch/0224-docker-close-channel-in-write-side-to-avoid-panic-in.patch
|
||||||
#end
|
#end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user