Skip to content

Fault tolerant steps may ignore chunks silently #3828

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
omarkad2 opened this issue Jan 11, 2021 · 5 comments
Closed

Fault tolerant steps may ignore chunks silently #3828

omarkad2 opened this issue Jan 11, 2021 · 5 comments
Labels
status: duplicate Issues that are duplicates of other issues type: bug

Comments

@omarkad2
Copy link

omarkad2 commented Jan 11, 2021

Bug description
During the execution of a fault tolerant Step, when a chunk executes successfully, it is tagged as “Completed”, and then, we try to commit the transaction.

In the case where the transaction commit fails with an exception that is not considered as Non-retryable or Fatal (by FaultTolerantStepBuider) like a RuntimeException, the exception handler logs the error in debug (SimpleRetryExceptionHandler#handleException), and we do not put back the chunk in the queue for retry (since tagged Completed) and consequently we skip the chunk silently while having it tagged as “Completed”.

We end up in this case with a "Completed" job with "Completed" chunks and no error stacks.

Environment
Spring Batch version: 3.0.10.RELEASE
Java version: 11
database: postgresql
ORM: hibernate

Steps to reproduce

  • Declare a job with a fault tolerant chunk-oriented step.
  • In the item writer make the transaction commit fail with a RuntimeException (for example) by overriding the beforeCommit method with the following:
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
            @Override
            public void beforeCommit(boolean readOnly) {
                throw new RuntimeException("test");
            }
});

Expected behavior
Retry the chunk, and if the error persist throw an error and mark the job as failed.

@omarkad2 omarkad2 added status: waiting-for-triage Issues that we did not analyse yet type: bug labels Jan 11, 2021
@fmbenhassine
Copy link
Contributor

Thank you for raising this issue. I believe this is a duplicate of #1189. Do you confirm that?

@fmbenhassine fmbenhassine added status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter and removed status: waiting-for-triage Issues that we did not analyse yet labels Jan 14, 2021
@omarkad2
Copy link
Author

Hello @benas I can confirm that it is the same issue. Is it something that you consider changing or will it be kept as is ?

@fmbenhassine
Copy link
Contributor

Thank you for your confirmation. I will close this as a duplicate of #1189.

Is it something that you consider changing or will it be kept as is ?

Both this issue and #1189 are reported against Spring Batch v3, which is not maintained anymore. If this is validated as a bug with a minimal complete example against the current v4.3.1, we will take a look.

@fmbenhassine fmbenhassine added status: duplicate Issues that are duplicates of other issues and removed status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter labels Jan 18, 2021
@patwix
Copy link

patwix commented May 2, 2023

Hello @fmbenhassine, i am also having this problem with 4.3.8.

@fmbenhassine
Copy link
Contributor

@patwix This was closed as duplicate of #1189. If you have the same issue, please upvote or add a comment on #1189.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate Issues that are duplicates of other issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants