So far, sofa-jraft does not support GraalVM Native Image. Therefore, I need to collect a lot of metadata in the project to ensure that the project can support Native Image. Therefore, the problem occurred in the Native Image startup phase after the metadata was collected. When starting RaftGroupService, an Illegal state: STATE_ERROR problem was returned. The complete stack trace information is as follows:
Caused by: java.lang.IllegalArgumentException: Illegal state: STATE_ERROR
at com.alipay.sofa.jraft.util.Requires.requireTrue(Requires.java:85)
at com.alipay.sofa.jraft.core.NodeImpl.becomeLeader(NodeImpl.java:1230)
at com.alipay.sofa.jraft.core.NodeImpl.electSelf(NodeImpl.java:1189)
at com.alipay.sofa.jraft.core.NodeImpl.init(NodeImpl.java:1115)
at com.alipay.sofa.jraft.core.NodeImpl.init(NodeImpl.java:141)
at com.alipay.sofa.jraft.RaftServiceFactory.createAndInitRaftNode(RaftServiceFactory.java:47)
at com.alipay.sofa.jraft.RaftGroupService.start(RaftGroupService.java:129)
at com.alibaba.nacos.core.distributed.raft.JRaftServer.createMultiRaftGroup(JRaftServer.java:260)
at com.alibaba.nacos.core.distributed.raft.JRaftProtocol.addRequestProcessors(JRaftProtocol.java:163)
at com.alibaba.nacos.naming.core.v2.service.impl.PersistentClientOperationServiceImpl.<init>(PersistentClientOperationServiceImpl.java:101)
at com.alibaba.nacos.naming.core.v2.service.impl.PersistentClientOperationServiceImpl__BeanDefinitions.lambda$getPersistentClientOperationServiceImplInstanceSupplier$0(PersistentClientOperationServiceImpl__BeanDefinitions.java:20)
I tried many ways to locate why this STATE_ERROR is generated. I focused on the NodeImpl.onError method and tried to find clues that might cause this error in NodeImpl.electSelf and NodeImpl.becomeLeader, but unfortunately all failed. I can only confirm that the onError method has been called in the three classes of FSMCallerImpl, Replicator, and LocalRaftMetaStorage. I need more information about why the electSelf and becomeLeader methods generate the STATE_ERROR error.
I can provide the following metadata information related to sofa-jraft collected when Nacos supports GraalVM:
Your question
So far, sofa-jraft does not support GraalVM Native Image. Therefore, I need to collect a lot of metadata in the project to ensure that the project can support Native Image. Therefore, the problem occurred in the Native Image startup phase after the metadata was collected. When starting RaftGroupService, an
Illegal state: STATE_ERROR
problem was returned. The complete stack trace information is as follows:I tried many ways to locate why this
STATE_ERROR
is generated. I focused on theNodeImpl.onError
method and tried to find clues that might cause this error inNodeImpl.electSelf
andNodeImpl.becomeLeader
, but unfortunately all failed. I can only confirm that theonError
method has been called in the three classes ofFSMCallerImpl
,Replicator
, andLocalRaftMetaStorage
. I need more information about why theelectSelf
andbecomeLeader
methods generate theSTATE_ERROR
error.I can provide the following metadata information related to sofa-jraft collected when Nacos supports GraalVM:
Your scenes
Nacos Console and Nacos Client need to support the startup method of GraalVM Native Image.
Environment
java -version
): GraalVM 17.0.12+8.1uname -a
): win11, macOS