You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using acquireStateMachine in DefaultStateMachineService the persisted machine to be overwritten with a new machine context before reaching the restore logic so the restored machine is always in the initial state.
After delving deeper into this, I found the source of the problem.
The problem lies in the fact that the AbstractStateMachineFactory overwrites the state of the machine when it is starting in delegateAutoStartup if the autoStartup property is true in this method.
But later we have problems, because occur calling the function callPostStateChangeInterceptors in AbstractStateMachine after starting created statemachine.
Also, we can view this problem in Redis with MONITOR command.
In the DefaultStateMachineService, the first command is create a new machine from the stateMachineFactory, and then restore it from the database, but at the time of creation the persisted state is overwritten to initial state.
Hello, I'm meeting the same thing. Restoring from 3 orthogonal regions lead to weird: "left" region is being restored normally to saved state, and two others - to initial states.
I guess this issue was fixed a bit earlier in #998 but not released. I'd like to solve this problem anyway
When using
acquireStateMachine
inDefaultStateMachineService
the persisted machine to be overwritten with a new machine context before reaching the restore logic so the restored machine is always in the initial state.After delving deeper into this, I found the source of the problem.
The problem lies in the fact that the
AbstractStateMachineFactory
overwrites the state of the machine when it is starting indelegateAutoStartup
if theautoStartup
property istrue
in this method.spring-statemachine/spring-statemachine-core/src/main/java/org/springframework/statemachine/config/AbstractStateMachineFactory.java
Line 363 in 3ad063a
At this moment all interceptors adding for every regions which correct.
spring-statemachine/spring-statemachine-core/src/main/java/org/springframework/statemachine/config/AbstractStateMachineFactory.java
Lines 347 to 355 in 3ad063a
But later we have problems, because occur calling the function
callPostStateChangeInterceptors
inAbstractStateMachine
after starting created statemachine.spring-statemachine/spring-statemachine-core/src/main/java/org/springframework/statemachine/support/AbstractStateMachine.java
Lines 956 to 962 in 3ad063a
And finally in
AbstractPersistingStateMachineInterceptor
occur write initial state created inAbstractStateMachineFactory
to DB.spring-statemachine/spring-statemachine-core/src/main/java/org/springframework/statemachine/persist/AbstractPersistingStateMachineInterceptor.java
Line 78 in 3ad063a
Also, we can view this problem in Redis with
MONITOR
command.In the
DefaultStateMachineService
, the first command is create a new machine from thestateMachineFactory
, and then restore it from the database, but at the time of creation the persisted state is overwritten to initial state.spring-statemachine/spring-statemachine-core/src/main/java/org/springframework/statemachine/service/DefaultStateMachineService.java
Lines 83 to 105 in 3ad063a
I think reorder the command in
acquireStateMachine
inDefaultStateMachineService
can solve this problem.Tell me, can this problem be solved in a similar way?
If yes, then I'm ready to start working on this task.
Thanks!)
The text was updated successfully, but these errors were encountered: