Open fredjoseph opened 1 year ago
I have the same problem, though it took me a lot of debugging to realize this is what's happening. Debugging some more, I think it is caused by some interaction between the lifecycle of the StateMachine
itself and the lifecycle of the StateMachineExecutor
. It's really hard to see through hundreds of lines of Reactor stack traces, but I think what is happening is this:
AbstractStateMachine.doPreStopReactively
)ReactiveStateMachineExecutor.triggerDisposable
is disposed, cancelling the subscriptionMono
created in ReactiveLifecycleManager
, Line 99
this.stopRequests.next().flatMap(Function.identity()).doOnSuccess(aVoid -> {
state.set(LifecycleState.STOPPED);
})
So the doOnSuccess
block is never executed and state is never set to STOPPED
.
It seems this makes a state machine instance completely unusable if it enters the end state once.
I think I can work around this by using a StateMachineFactory
and creating a new state machine instance instead of reusing the existing one, but still this looks like a bug to me.
Same issue here, This removes the ability to pool statemachine instances (or reuse state machine instances in general).
Hi,
I currently have a problem when stopping a state machine that is already on an end state. If the configuration specified a state to be an end state, a call to the
stopReactively
method will update thereactiveLifecycleManager
state toSTOPPING
instead ofSTOPPED
.If I try to start again this State Machine (after reseting the State Machine with a new context), the
reactiveLifecycleManager
state will be kept toSTOPPING
instead ofSTARTED
As a workaround, I can replace the line
.end(States.S1)
by.state(States.S1)
, but in this case what is the purpose to mark a state as end state ? Do you have any examples where the end method is still useful ?