Hanisha Koneru created RATIS-1119:
-------------------------------------

             Summary: StateMachine is not closed when StateMachineUpdater 
encounters exception
                 Key: RATIS-1119
                 URL: https://issues.apache.org/jira/browse/RATIS-1119
             Project: Ratis
          Issue Type: Bug
            Reporter: Hanisha Koneru


When StateMachineUpdater encounters an exception while applying the log to 
StateMachine, it shuts down the RaftServerImpl.
{code:java}
#StateMachineUpdater
public void run() {
 try {
  ...
  ...
  final MemoizedSupplier<List<CompletableFuture<Message>>> futures = applyLog();
  ...
 } catch (Throwable t) {
   ...
   server.shutdown(); # RaftServerImpl#shutdown()
 }{code}
The RaftServerImpl#shutdown() in turn calls the 
StateMachineUpdater#stopAndJoin() which waits for the StateMachineUpdater 
thread to die. This creates a circular dependency on the StateMachineUpdater 
thread to exit. In the process, StateMachineUpdater#stop() is never called and 
hence StateMachine is never informed that the RaftServer is shutdown.
{code:java}
StateMachineUpdater#run() on exception -> RaftServerImpl#shutdown() -> 
ServerState#close() -> StateMachineUpdater#stopAndJoin() -> updates stopIndex 
and waits for updater thread to die.{code}
 

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to