[ https://issues.apache.org/jira/browse/RATIS-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17849129#comment-17849129 ]
Tsz-wo Sze commented on RATIS-2100: ----------------------------------- It seems that we can fix it as below: {code} +++ b/ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderDaemon.java @@ -108,8 +108,11 @@ class LogAppenderDaemon { }; public CompletableFuture<State> tryToClose() { - if (lifeCycle.transition(TRY_TO_CLOSE) == CLOSING) { + final State state = lifeCycle.transition(TRY_TO_CLOSE); + if (state == CLOSING) { daemon.interrupt(); + } else if (state == CLOSED) { + closeFuture.complete(CLOSED); } return closeFuture; } {code} > The `closeFuture` never completed while closing from the `NEW` state. > --------------------------------------------------------------------- > > Key: RATIS-2100 > URL: https://issues.apache.org/jira/browse/RATIS-2100 > Project: Ratis > Issue Type: Bug > Reporter: Chung En Lee > Assignee: Chung En Lee > Priority: Critical > > Currently, the {{closeFuture}} only completes after the {{LogAppenderDaemon}} > has started. However, when closing from the {{NEW}} state, the transition is > {{NEW}} -> {{{}CLOSED{}}}, and the {{LogAppenderDaemon}} was not started. -- This message was sent by Atlassian Jira (v8.20.10#820010)