docker stats: fix 'panic: close of closed channel'

bugfix: https://gitee.com/src-openeuler/docker/issues/I6LNNW?from=project-issue

Signed-off-by: Song Zhang <zhangsong34@huawei.com>
This commit is contained in:
Song Zhang 2023-03-10 15:42:11 +08:00
parent dc31905870
commit 8ed0a65d0b
5 changed files with 40 additions and 3 deletions

View File

@ -1 +1 @@
18.09.0.317
18.09.0.318

View File

@ -1,6 +1,6 @@
Name: docker-engine
Version: 18.09.0
Release: 317
Release: 318
Epoch: 2
Summary: The open-source application container engine
Group: Tools/Docker
@ -213,6 +213,12 @@ fi
%endif
%changelog
* Fri Mar 10 2023 Song Zhang<zhangsong34@huawei.com> - 18.09.0-318
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:docker stats: fix 'panic: close of closed channel'
* Fri Feb 17 2023 chenjiankun<chenjiankun1@huawei.com> - 18.09.0-317
- Type:bugfix
- CVE:NA

View File

@ -1 +1 @@
287e8bd417a2969ddef3ae612763cfed8f22d5e5
0b9bbc0a1c50c5b83c48e3fca9162cf673705d92

View File

@ -0,0 +1,30 @@
From 631e56a7e27202529172fe307c7e324a74c56271 Mon Sep 17 00:00:00 2001
From: fanjiyun <fan.jiyun@zte.com.cn>
Date: Sat, 24 Oct 2020 11:47:53 +0800
Subject: [PATCH] docker stats: fix 'panic: close of closed channel'
Signed-off-by: fanjiyun <fan.jiyun@zte.com.cn>
Upstream-commit: 1b8826beee9c86b76091931991f037c1410d0ea5
Component: engine
---
components/engine/pkg/pubsub/publisher.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/components/engine/pkg/pubsub/publisher.go b/components/engine/pkg/pubsub/publisher.go
index 32b2f189259..e53d17d515a 100644
--- a/components/engine/pkg/pubsub/publisher.go
+++ b/components/engine/pkg/pubsub/publisher.go
@@ -66,8 +66,11 @@ func (p *Publisher) SubscribeTopicWithBuffer(topic topicFunc, buffer int) chan i
// Evict removes the specified subscriber from receiving any more messages.
func (p *Publisher) Evict(sub chan interface{}) {
p.m.Lock()
- delete(p.subscribers, sub)
- close(sub)
+ _, exists := p.subscribers[sub]
+ if exists {
+ delete(p.subscribers, sub)
+ close(sub)
+ }
p.m.Unlock()
}

View File

@ -234,4 +234,5 @@ patch/0233-docker-cleanup-netns-file-when-close-docker-daemon.patch
patch/0234-docker-Read-connection-marking-information-from-CT-f.patch
patch/0235-docker-do-not-stop-health-check-before-sending-signa.patch
patch/0236-docker-set-freezer.state-to-Thawed-to-increase-freez.patch
patch/0237-docker-stats-fix-panic.patch
#end