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
Job restart after stop fails [BATCH-2315] #1287
Comments
Chris Haas commented Attach an updated DecisionStepTests that illustrates the problem. |
Chris Haas commented Note that, in all of the existing test cases, the step/decider keeps track of how many times it was called and, on a even number, returns a string to match the <next> tag, which means the restart attribute on the <stop> is never executed. |
Chris Haas commented I've discovered the source of the problem. I had switched to the 3.0 schema, which adds the attribute exit-code to the <stop> tag, with a default value of "STOPPED". This value causes the restart attribute to be ignored. If I add exit-code="", the code runs as expected. So,the bug fix is to update the documentation for the stop tag to indicate that it uses the exit-code attribute. |
Chris Haas commented It would be nice to fix this, so that, during a <stop> you are allowed to change the ExitStatus - currently you cannot. As a suggestion to see how bad the problem is, try upgrading one of the XML-based unit tests that uses <stop> to change the xsd reference from 2.2 to 3.0 - it will fail on restart. |
Minimal complete example to reproduce the issue here: https://github.com/benas/spring-batch-lab/tree/main/issues/gh1287 |
Chris Haas opened BATCH-2315 and commented
In our jobs we use the following construct to conditionally stop a job based on a property passed into the job:
In Spring Batch 2.1, "placeAccounts" is executed when the job is restarted. In Spring Batch 3, the decision is re-executed, which of course means the job immediately stops again.
In 3.0.1, the job's flow has stateTransitions for the decision look like
but in 2.1, they look like:
Notice that the next element on stop60 is blank, which is probably the cause of the problem.
Affects: 3.0.1
2 votes, 3 watchers
The text was updated successfully, but these errors were encountered: