Mirza Aliev created IGNITE-28456:
------------------------------------

             Summary: Race condition in NodeImpl.init() causes double 
electSelf() for single-node Raft groups        
                 Key: IGNITE-28456
                 URL: https://issues.apache.org/jira/browse/IGNITE-28456
             Project: Ignite
          Issue Type: Bug
            Reporter: Mirza Aliev


h3. Motivation

In a single-node Raft group, NodeImpl.init() calls stepDown() and then acquires 
the write-lock to call electSelf() (fast-path election). However, between 
stepDown() and the write-lock acquisition, the election timer can fire on a 
separate thread and complete a full election cycle — transitioning the node to 
STATE_LEADER and setting confCtx to BUSY via confCtx.flush(). 

                                                                                
                                                                              
When init() then acquires the write-lock and calls electSelf() a second time, 
it calls becomeLeader() again, which tries to call confCtx.flush() while 
confCtx is still BUSY — resulting in an IllegalStateException.

*Fix:* Guard the electSelf() call in init() with a state != STATE_LEADER check. 
   



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to