Skip to content

Throwing exceptions inside a ChunkListener results in endless loop [BATCH-1783] #1806

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
spring-projects-issues opened this issue Aug 10, 2011 · 3 comments

Comments

@spring-projects-issues
Copy link
Collaborator

Morten Andersen-Gott opened BATCH-1783 and commented

If an exception is thrown in beforeChunk in a ChunkListener and the job is configured with skips (but not to skip the exception that is thrown from the ChunkListener) it will result in an endless loop. Same will happen if you have configured your job for retries.

If neither retry nor skip is configured, the job will end with ExitStatus.FAILED, as expected. Which makes me suspect the issue is in the exception handling in some of the components added when skip or retry comes into play.

I've attached two files based on the Spring Batch template from STS that can be dropped in to reproduce the issue.


Affects: 2.1.8

Attachments:

Referenced from: commits b075851, af84be4

@spring-projects-issues
Copy link
Collaborator Author

Morten Andersen-Gott commented

I've added a failing unit test in magott@0bf5f23
It is added to the FaultTolerantStepFactoryBeanRollbackTests which is probably not the best place to have the test. However, I did try to add it to the TaskletStepExceptionTests at first, but I couldn't get it to fail. I rely on some of the magic being applied in the FaultTolerantStepFactoryBean to reproduce the issue.

@spring-projects-issues
Copy link
Collaborator Author

Morten Andersen-Gott commented

Created a fix that will force step termination if an exception is thrown in the chunklistener. Pull request: #11

@spring-projects-issues
Copy link
Collaborator Author

Dave Syer commented

Merged pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant