This is an automated email from the ASF dual-hosted git repository.

jiangtian pushed a commit to branch native_raft
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/native_raft by this push:
     new 2c9d7346e2 fix NPE during stop
2c9d7346e2 is described below

commit 2c9d7346e26a9cf5af9d5b926588fb670cfa4d42
Author: Tian Jiang <[email protected]>
AuthorDate: Wed May 17 12:33:28 2023 +0800

    fix NPE during stop
---
 .../org/apache/iotdb/consensus/natraft/protocol/RaftMember.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
 
b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
index 7c983dfd56..1855e2cde1 100644
--- 
a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
+++ 
b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/RaftMember.java
@@ -373,10 +373,11 @@ public class RaftMember {
    * induce side effects.
    */
   public void stop() {
-    setStopped(true);
-    if (heartbeatThread == null) {
+    if (stopped) {
       return;
     }
+    setStopped(true);
+
     closeLogManager();
 
     logDispatcher.stop();
@@ -396,9 +397,6 @@ public class RaftMember {
         logger.error("Unexpected interruption when waiting for commitLogPool 
to end", e);
       }
     }
-    status.leader.set(null);
-    catchUpManager = null;
-    heartbeatThread = null;
 
     if (flowBalancer != null) {
       flowBalancer.stop();

Reply via email to