-
Notifications
You must be signed in to change notification settings - Fork 2.4k
After upgrading to spring batch 5 from spring batch 4, service is failing on load #4789
-
Bug description
After the upgrade, during a load test, the service threads are getting blocked due to the below error and the service is returning 504 timeout but this behavior is not with spring batch 4. Please help
stackTrace:
java.lang.Thread.State: BLOCKED (on object monitor)
at org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer.getNextKey(MySQLMaxValueIncrementer.java:118)
- waiting to lock <0x00000000c322ddf0> (a org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer)
at org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextLongValue(AbstractDataFieldMaxValueIncrementer.java:128)
at org.springframework.batch.core.repository.dao.JdbcJobInstanceDao.createJobInstance(JdbcJobInstanceDao.java:150)
at org.springframework.batch.core.repository.support.SimpleJobRepository.createJobExecution(SimpleJobRepository.java:169)
at java.lang.invoke.LambdaForm$DMH/0x0000004001e90000.invokeInterface(java.base@21.0.5/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x0000004002038800.invoke(java.base@21.0.5/LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/0x0000004001002800.invokeExact_MT(java.base@21.0.5/LambdaForm$MH)
at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(java.base@21.0.5/DirectMethodHandleAccessor.java:155)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(java.base@21.0.5/DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke(java.base@21.0.5/Method.java:580)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.transaction.interceptor.TransactionInterceptor1ドル.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:391)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.lambda$getObject0ドル(AbstractJobRepositoryFactoryBean.java:204)
at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean$$Lambda/0x0000004001f122e0.invoke(Unknown Source)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:244)
at jdk.proxy3.$Proxy118.createJobExecution(jdk.proxy3/Unknown Source)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:145)
at org.springframework.batch.core.launch.support.TaskExecutorJobLauncher.run(TaskExecutorJobLauncher.java:59)
Environment
Spring Batch version - 5
Java version - 21
database - MySQL
Expected behavior
there should not be any 504 and service should keep on receiving requests
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments
-
I think you will encounter same issue with Spring Batch 4 if the load is heavy enough.
Beta Was this translation helpful? Give feedback.
All reactions
-
load is much less( just 5 RPS of a batch of 25). The spring batch 4 was easily able to handle this
Beta Was this translation helpful? Give feedback.
All reactions
-
I see nothing in v5 that changed with regard to the job launcher in Spring Batch. So this issue might happen with v4 as well. But since it seems to happen at the incrementer level (MySQLMaxValueIncrementer
), I guess it might not be related to Spring Batch. Can you please provide a minimal example that reproduces the issue? A GitHub repo or a Docker-based integration test would be great (we have an example here).
Beta Was this translation helpful? Give feedback.