From 73e16e42c5ac47d747135d3a3810fa6e41c55deb Mon Sep 17 00:00:00 2001 From: lizhimins <707364882@qq.com> Date: Wed, 6 Sep 2023 14:37:26 +0800 Subject: [PATCH] [ISSUE #7305] Fix metrics and transactional not shutdown cause broker coredump --- .../java/org/apache/rocketmq/broker/BrokerController.java | 8 ++++++++ .../queue/TransactionalMessageServiceImpl.java | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java index e8f9437029d..6aba70cb21b 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java @@ -1302,6 +1302,10 @@ protected void shutdownBasicService() { this.fastRemotingServer.shutdown(); } + if (this.brokerMetricsManager != null) { + this.brokerMetricsManager.shutdown(); + } + if (this.brokerStatsManager != null) { this.brokerStatsManager.shutdown(); } @@ -1324,6 +1328,10 @@ protected void shutdownBasicService() { this.ackMessageProcessor.shutdownPopReviveService(); } + if (this.transactionalMessageService != null) { + this.transactionalMessageService.close(); + } + if (this.notificationProcessor != null) { this.notificationProcessor.getPopLongPollingService().shutdown(); } diff --git a/broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java b/broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java index 93fa725a93c..48db828e0ae 100644 --- a/broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java +++ b/broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java @@ -629,7 +629,9 @@ public boolean open() { @Override public void close() { - + if (this.transactionalOpBatchService != null) { + this.transactionalOpBatchService.shutdown(); + } } public Message getOpMessage(int queueId, String moreData) {