Spring Batch: EmptyResultDataAccessException on step status update in production job #4683
Unanswered
NikolasTrapp
asked this question in
Q&A
Replies: 1 comment
-
Thank you for opening this discussion and for providing these details. I can't see from what you shared what could cause this issue (this kind of concurrency issues are hard to diagnose statically). Were you able to replicate the behaviour similar to what you have in production with a testcontainers-based test? We have some samples in the code base with different databases and brokers, so if you manage to create a minimal example that reproduces the issue, I will take a look deeper. Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're facing an issue with a Spring Batch job that only occurs in our production environment. The job fails with the following error when attempting to update the step status, which causes the entire job to halt and leaves inconsistencies in the application:
Context:
We are building a multi-tenant Spring Cloud application. The issue happens during a job used to process customer file imports. The process consists of two steps:
The error only occurs in the second job, specifically when reading the database entries and sending them to the microservices. Importantly, the first job, which mirrors the configuration of the second job (Uses teh same CustomDefaultConfiguration, transactionManager and datasource), has never experienced this issue, suggesting that the problem likely stems from some implementation specific to the second job
We suspect the issue may be related to concurrency or transaction handling, but it’s challenging to replicate this locally. We've reviewed our configuration and tried various adjustments without success.
How can we better diagnose this issue in a production-like setting, given its environment-specific nature?
What configurations or strategies should we explore to manage concurrency and ensure consistent step execution status updates?
Any insights into what might cause this error in a production environment, particularly with a custom transaction manager in a multi-tenant setup? What approaches should we try to better identify the root cause?
Code:
We have a custom configuration for DefaultBatchConfigurer to use our MultiTenantConnectionProvider:
This is where the job is started:
Our JobSendData:
We have a SenderStep intarface for generic implementation:
And we have a abstract class to create steps:
And we also have a ChunkListener that controlls visual data
And our StepExecutionListener:
DoInTransaction basically runs the code in a
@Transactional
method.Beta Was this translation helpful? Give feedback.
All reactions