You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "runzhiwang (Jira)" <ji...@apache.org> on 2021/02/02 06:01:00 UTC

[jira] [Updated] (RATIS-1119) StateMachine is not closed when StateMachineUpdater encounters exception

     [ https://issues.apache.org/jira/browse/RATIS-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

runzhiwang updated RATIS-1119:
------------------------------
    Target Version/s: 1.1.0  (was: 2.0.0)

> 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
>             Fix For: 1.1.0
>
>          Time Spent: 50m
>  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)