[ 
https://issues.apache.org/jira/browse/RATIS-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223383#comment-17223383
 ] 

Tsz-wo Sze commented on RATIS-1119:
-----------------------------------

[~hanishakoneru], thanks for filing this JIRA.  I just have created a pull 
request https://github.com/apache/incubator-ratis/pull/242 .  Could you test 
it?  I don't have an easy way to test it.

> 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
>          Components: server
>            Reporter: Hanisha Koneru
>            Assignee: Tsz-wo Sze
>            Priority: Critical
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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