Hello Spring Batch Experts.
I came across a use case where my batch job hangs indefinitely.
I am in a middle of batch migration from 1.1.4 to 2.1.6. This issue is a show stopper for us right now.
While i do the refactoring i am running Junit tests to verify correctness.
Job starts the first step, reads one item, writes, reads second item, writes then TaskletSep.java calls semaphore.acquire() on line 390 and hangs.
Our batches are of the simplest uses case. We use readers to call pojo services to fetch next candidate item and we use writers to delegate to another pojo service to process the item. We have commit interval set to 1 and generally we expect to skip not repeat on any exception. Our pojo services have transaction boundries configured, out transaction manager is JPA transaction manager.
Job definition:
simple-job-launcher-context.xmlCode:<job id="nonRenewal180DayJob" xmlns="http://www.springframework.org/schema/batch"> <step id="NonRenewStep" next="ReviewStep"> <tasklet transaction-manager="transactionManager"> <chunk reader="nonRenew180DayReader" writer="nonRenew180DayWriter" commit-interval="1" skip-limit="100000"> <skippable-exception-classes> <include class="java.lang.Exception" /> </skippable-exception-classes> </chunk> <listeners> <listener> <beans:bean class="com.bipt.tiva.batch.renewal.listener.NonRenew180DayListener" parent="isfJobListener" /> </listener> </listeners> </tasklet> </step> .... more steps exist
Junit Test: snippetCode:<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"> <property name="jobRepository" ref="jobRepository" /> </bean> <bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" p:validateTransactionState="false" p:isolationLevelForCreate="ISOLATION_DEFAULT" p:transactionManager-ref="transactionManager"/> <bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
Our original 1.1.4 batch project did not use database backed JobRepositoryCode:@Resource JobLauncher launcher; @Resource Job job; @Test @Transactional public void testLaunchJob() throws Exception { launcher.run(job, jobParameters); }
and during this migration phase we want to continue this approach for now.
My question is this; did i perhaps miss some configuration either in the job definition itself or generally setting up the framework. Can the use of MapJobRepositoryFactoryBean be the reason for the job hang?
Your input is most appreciated.
Thank you.


Reply With Quote
