From 4820dd76e54102108b66166ab5c7413144a5d34e Mon Sep 17 00:00:00 2001 From: congqixia Date: Sat, 16 Nov 2024 11:20:32 +0800 Subject: [PATCH] fix: Close leaked health check kafka producer (#37728) Related to #36822 Signed-off-by: Congqi Xia --- pkg/mq/msgstream/msgstream_util.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/mq/msgstream/msgstream_util.go b/pkg/mq/msgstream/msgstream_util.go index 903b6cf021fab..7544c4d129e77 100644 --- a/pkg/mq/msgstream/msgstream_util.go +++ b/pkg/mq/msgstream/msgstream_util.go @@ -114,6 +114,7 @@ func KafkaHealthCheck(clusterStatus *pcommon.MQClusterStatus) { clusterStatus.Reason = fmt.Sprintf("failed to create Kafka producer: %v", err) return } + defer producer.Close() metadata, err := producer.GetMetadata(nil, false, 3000) if err != nil {