Skip to content

Reset may start submachine too early #386

Closed
@jvalkeal

Description

@jvalkeal

Logic is a bit off when machines are reset and problem comes with nested states when threading is used.

09:05:31,025  INFO Test worker support.LifecycleObjectSupport [Test worker] - started org.springframework.statemachine.support.DefaultStateMachineExecutor@19b181ca
09:05:31,025  INFO Test worker support.LifecycleObjectSupport [Test worker] - started MANUAL AUTOMATIC  /  / uuid=d78a114e-d696-46cd-a0e3-cc2ee70442bb / id=null
09:05:31,025 DEBUG Test worker support.AbstractStateMachine [Test worker] - State reseted: stateMachine=[ERROR MANUAL AUTOMATIC TASKS TASK_2 TASK_2_INITIAL TASK_3_INITIAL TASK_3 TASK_1 TASK_1_INITIAL READY JOIN FORK CHOICE  / ERROR / uuid=c271d93c-a40c-45cc-8364-c4231387e21e / id=null] stateMachineContext=[DefaultStateMachineContext [id=null, childs=[], state=ERROR, historyStates={}, event=null, eventHeaders=null, extendedState=null]]
09:05:31,025 DEBUG ThreadPoolTaskExecutor-1 support.DefaultStateMachineExecutor [ThreadPoolTaskExecutor-1] - Process event queue, size=0
09:05:31,025  INFO Test worker support.LifecycleObjectSupport [Test worker] - started StateMachineState [getIds()=[ERROR], toString()=AbstractState [id=ERROR, pseudoState=null, deferred=[], entryActions=[], exitActions=[], stateActions=[], regions=[], submachine=MANUAL AUTOMATIC  /  / uuid=d78a114e-d696-46cd-a0e3-cc2ee70442bb / id=null], getClass()=class org.springframework.statemachine.state.StateMachineState]
09:05:31,025 DEBUG Test worker support.AbstractStateMachine [Test worker] - Request to reset state machine: stateMachine=[MANUAL AUTOMATIC  /  / uuid=d78a114e-d696-46cd-a0e3-cc2ee70442bb / id=null] stateMachineContext=[DefaultStateMachineContext [id=null, childs=[], state=ERROR, historyStates={}, event=null, eventHeaders=null, extendedState=null]]
09:05:31,026 DEBUG ThreadPoolTaskExecutor-1 support.AbstractStateMachine [ThreadPoolTaskExecutor-1] - Enter state=[ObjectState [getIds()=[AUTOMATIC], getClass()=class org.springframework.statemachine.state.ObjectState, hashCode()=1309168632, toString()=AbstractState [id=AUTOMATIC, pseudoState=org.springframework.statemachine.state.DefaultPseudoState@40cfb449, deferred=[], entryActions=[org.springframework.statemachine.recipes.tasks.TasksHandler$6@44f03888], exitActions=[], stateActions=[], regions=[], submachine=null]]]
09:05:31,026  INFO Test worker support.LifecycleObjectSupport [Test worker] - started ObjectState [getIds()=[AUTOMATIC], getClass()=class org.springframework.statemachine.state.ObjectState, hashCode()=1309168632, toString()=AbstractState [id=AUTOMATIC, pseudoState=org.springframework.statemachine.state.DefaultPseudoState@40cfb449, deferred=[], entryActions=[org.springframework.statemachine.recipes.tasks.TasksHandler$6@44f03888], exitActions=[], stateActions=[], regions=[], submachine=null]]
09:05:31,026 DEBUG Test worker support.AbstractStateMachine [Test worker] - Request to reset state machine: stateMachine=[TASK_2 TASK_2_INITIAL  /  / uuid=97c7524d-0ef9-4fc3-bc89-3e4d3665dd6f / id=null] stateMachineContext=[DefaultStateMachineContext [id=null, childs=[], state=ERROR, historyStates={}, event=null, eventHeaders=null, extendedState=null]]
09:05:31,026 DEBUG Test worker support.AbstractStateMachine [Test worker] - Request to reset state machine: stateMachine=[TASK_3_INITIAL TASK_3  /  / uuid=ab460d8a-6abb-4213-8a87-9414a9b47036 / id=null] stateMachineContext=[DefaultStateMachineContext [id=null, childs=[], state=ERROR, historyStates={}, event=null, eventHeaders=null, extendedState=null]]
09:05:31,026 DEBUG Test worker support.AbstractStateMachine [Test worker] - Request to reset state machine: stateMachine=[TASK_1 TASK_1_INITIAL  /  / uuid=745b41e4-1178-4745-a261-954865a6eab2 / id=null] stateMachineContext=[DefaultStateMachineContext [id=null, childs=[], state=ERROR, historyStates={}, event=null, eventHeaders=null, extendedState=null]]

Machines should not start until user request start from root machine.

There are further issues for restoring machines as this same issue causes some bad behaviour as persist/restore also tries to handle lifecycle logic during a restore operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions