You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Hanisha Koneru (Jira)" <ji...@apache.org> on 2020/11/02 16:10:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17224777#comment-17224777 ]
Hanisha Koneru commented on RATIS-1119:
---------------------------------------
Thanks [~szetszwo] for fixing this. I tested the patch and verified it works. StateMachineUpdater#stop() is called after an exception leading to shutdown.
> 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)