From 0c21abd535319ce4849d24a8b3a08d4555c69863 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Mon, 5 Oct 2020 10:07:06 -0400 Subject: [PATCH] ceph: prevent closing of channel more than once Once we close the channel for the monitoring daemons, we update the monitoring status so as to not call them again. This is to prevent "close of closed channel" panic. Co-authored-by: Travis Nielsen Signed-off-by: Nitin Goyal Signed-off-by: Raghavendra Talur --- pkg/operator/ceph/cluster/controller.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/operator/ceph/cluster/controller.go b/pkg/operator/ceph/cluster/controller.go index d24100fcf..4f1680d98 100644 --- a/pkg/operator/ceph/cluster/controller.go +++ b/pkg/operator/ceph/cluster/controller.go @@ -369,13 +369,10 @@ func (c *ClusterController) requestClusterDelete(cluster *cephv1.CephCluster) (r } // close the goroutines watching the health of the cluster (mons, osds, ceph status) - var isDisabled bool for _, daemon := range monitorDaemonList { - isDisabled = isMonitoringDisabled(daemon, cluster.Spec) - if _, ok := cluster.monitoringChannels[daemon]; ok { - if !isDisabled { - close(cluster.monitoringChannels[daemon].stopChan) - } + if monitoring, ok := cluster.monitoringChannels[daemon]; ok && monitoring.monitoringRunning { + close(cluster.monitoringChannels[daemon].stopChan) + cluster.monitoringChannels[daemon].monitoringRunning = false } } }