Skip to content

An exception in Action causes infinite transition #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
miron4dev opened this issue Apr 10, 2017 · 6 comments
Closed

An exception in Action causes infinite transition #344

miron4dev opened this issue Apr 10, 2017 · 6 comments
Labels
type/bug Is a bug report
Milestone

Comments

@miron4dev
Copy link

miron4dev commented Apr 10, 2017

If any exception occurs inside your Action, then Spring State Machine infinitely invokes Action that throws the Exception again.

Server Log:

2017-04-10 19:11:33.450  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.451  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.453  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.454  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.456  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.457  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.459  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.461  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.462  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.464  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>
2017-04-10 19:11:33.466  WARN 17036 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@60db47a8 caused error <Exception Details>

// infinity

In the attached demo, I've prepared simple example to reproduce this issue.
You can invoke deployed REST service using this endpoint http://localhost:8380/doSomething and execute properly configured state machine.
demo.zip

@jvalkeal jvalkeal added the type/bug Is a bug report label Apr 20, 2017
@jvalkeal jvalkeal added this to the 1.2.4.RELEASE milestone Apr 20, 2017
@jvalkeal
Copy link
Contributor

Good catch, this is indeed caused by loop which is needed to follow anonymous transitions and possible error there ended up with infinite loop. I may need to think about how to properly handle this as it's a bit wrong to just stop execution. I'll handle further tweaks in other tickets and fix this loop issue here.

jvalkeal added a commit to jvalkeal/spring-statemachine that referenced this issue Apr 20, 2017
- Executor is following anonymous transitions in a loop
  and if there is an exception in actions with this transition,
  effectively executor ended into infinite loop.
- No bailing out from this loop if we cannot continue.
- Fixes spring-projects#344
@jvalkeal
Copy link
Contributor

Fixed in 1.2.x per e25c5c6

jvalkeal added a commit to jvalkeal/spring-statemachine that referenced this issue May 5, 2017
- Executor is following anonymous transitions in a loop
  and if there is an exception in actions with this transition,
  effectively executor ended into infinite loop.
- No bailing out from this loop if we cannot continue.
- Backport spring-projects#344
- Relates spring-projects#307
@miron4dev
Copy link
Author

miron4dev commented May 11, 2017

Hello,

The fix partially helped, but now the Action occurs twice.

Server Log:

2017-05-11 18:22:06.061  WARN 20948 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@31441b7e caused error java.lang.NullPointerException: Something was wrong
2017-05-11 18:22:06.062  WARN 20948 --- [nio-8380-exec-1] o.s.s.support.AbstractStateMachine       : Aborting as transition org.springframework.statemachine.transition.DefaultExternalTransition@31441b7e caused error java.lang.NullPointerException: Something was wrong

@jvalkeal
Copy link
Contributor

ok, I'll check it out.

@jvalkeal jvalkeal reopened this May 11, 2017
@miron4dev
Copy link
Author

miron4dev commented May 22, 2017

Do you have any news about this problem? I can try to analyze the issue and prepare a pull request by myself, if you will check it.

@jvalkeal
Copy link
Contributor

Closing in favour of #384

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Is a bug report
Projects
None yet
Development

No branches or pull requests

2 participants