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

Tsz Wo Nicholas Sze commented on RATIS-578:
-------------------------------------------

Let's focus on the first  ILLEGAL TRANSITION.
{code}
java.lang.IllegalStateException: ILLEGAL TRANSITION: In 
3d75e29e-ff2a-47a6-82c4-6408d200876d:2019group--CB73AD2587F6:LeaderElection13, 
STARTING -> CLOSED
{code}
It seems the bug is in LeaderElection.start()
{code}
//LeaderElection.java
  void LeaderElection.java() {
    lifeCycle.startAndTransition(daemon::start);
  }
{code}
The code is equivalent to 
#     lifeCycle.transition(LifeCycle.State.STARTING);
#    daemon.start();
#    lifeCycle.transition(LifeCycle.State.RUNNING);

However, #2 starts a new thread.  The new thread may hit an exception and 
transit the state to CLOSED before the original thread runs #3.

> Illegal State transition in LeaderElection
> ------------------------------------------
>
>                 Key: RATIS-578
>                 URL: https://issues.apache.org/jira/browse/RATIS-578
>             Project: Ratis
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 0.3.0
>            Reporter: Mukul Kumar Singh
>            Assignee: Siddharth Wagle
>            Priority: Major
>              Labels: ozone
>             Fix For: 0.4.0
>
>
> Illegal State transition in LeaderElection
> {code}
> java.lang.IllegalStateException: ILLEGAL TRANSITION: In 
> 3d75e29e-ff2a-47a6-82c4-6408d200876d:2019group--CB73AD2587F6:LeaderElection13,
>  STARTING -> CLOSED
> java.lang.IllegalStateException: ILLEGAL TRANSITION: In 
> 3d75e29e-ff2a-47a6-82c4-6408d200876d:group-CB73AD2587F6:LeaderElection13, 
> CLOSED -> RUNNING
> java.lang.IllegalStateException: ILLEGAL TRANSITION: In 
> 37da83b0-33ff-44cf-aeb9-67a102e13468:group-9FC4313E1696:LeaderElection217, 
> RUNNING -> CLOSED
> java.lang.IllegalStateException: IL2LEGAL TRANSITION: I0n 
> 95ef0599-6d8a-40f8-a69c-7ba0c956dc6c:group-21734B88A322:LeaderElection265, 
> RUNNING -> CLOSED
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to