오류관리

org.springframework.transaction.CannotCreateTransactionException

k9e4h 2021. 4. 23. 10:49

Spring Batch 개별 step 돌릴땐 괜찮은데 전체 step이 돌지 않는다!

 

첫번째 에러 상황

Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30000ms.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:305)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.startTransaction(AbstractPlatformTransactionManager.java:400)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:574)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:361)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy78.update(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy78.update(Unknown Source)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:196)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:68)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:68)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)
... 5 common frames omitted

 

logback-spring.xml에 아래 코드 추가하여 로그 남겨보기

<logger name="com.zaxxer.hikari" level="debug" additivity="false"> 
	<appender-ref ref="stdout"/>
</logger>

 

남은 로그

2021-04-23 03:05:50 DEBUG [HikariPool-2 housekeeper] (HikariPool.java:421) - HikariPool-2 - Pool stats (total=10, active=0, idle=10, waiting=0)
2021-04-23 03:05:50 DEBUG [HikariPool-2 housekeeper] (HikariPool.java:517) - HikariPool-2 - Fill pool skipped, pool is at sufficient level.
2021-04-23 03:05:52 DEBUG [HikariPool-3 housekeeper] (HikariPool.java:421) - HikariPool-3 - Pool stats (total=30, active=0, idle=30, waiting=0)
2021-04-23 03:05:52 DEBUG [HikariPool-3 housekeeper] (HikariPool.java:517) - HikariPool-3 - Fill pool skipped, pool is at sufficient level.
2021-04-23 03:06:02 DEBUG [HikariPool-1 housekeeper] (HikariPool.java:421) - HikariPool-1 - Pool stats (total=10, active=10, idle=0, waiting=2)
2021-04-23 03:06:02 DEBUG [HikariPool-1 housekeeper] (HikariPool.java:517) - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
2021-04-23 03:06:03 DEBUG [SimpleAsyncTaskExecutor-21] (HikariPool.java:421) - HikariPool-1 - Timeout failure stats (total=10, active=10, idle=0, waiting=1)
2021-04-23 03:06:03 ERROR [SimpleAsyncTaskExecutor-21] (Slf4jSpyLogDelegator.java:130) - null. DataSource.getConnection()
java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30001ms.

 

 

...?!

 

 

 

 

 

hikari connection pool option - k9e4h.tistory.com/372

 

woowabros.github.io/experience/2020/02/06/hikaricp-avoid-dead-lock.html

 

HikariCP Dead lock에서 벗어나기 (이론편) - 우아한형제들 기술 블로그

안녕하세요! 공통시스템개발팀에서 메세지 플랫폼 개발을 하고 있는 이재훈입니다. 메세지 플랫폼 운영 장애를 바탕으로 HikariCP에서 Dead lock이 발생할 수 있는 case와Dead lock을 회피할 수 있는 maxi

woowabros.github.io

 

do-hansung.tistory.com/41

 

Spring boot Thread Pools 에러

■ 사내 개발자가 개발한 spring boot 프로젝트를 K8S에 올리는 도중 아래와 같은 에러가 발생, Mariadb를 쓰고있는 상태였습니다. 구글링을 하면서 참고한 내용을 저만의 방식으로 history 차원에서 정

do-hansung.tistory.com

 

jamong-icetea.tistory.com/212

 

[Spring Boot] This connection has been closed

This connection has been closed. 실제 서버를 운영하고 있는 도중 위와 같은 에러가 발생했다. 커넥션이 닫혔다는 내용인데, 그 이유야 여러가지가 있을 것이다. "HikariPool-1 - Connection is not available,..

jamong-icetea.tistory.com

mkyong.com/jdbc/hikaripool-1-connection-is-not-available-request-timed-out-after-30002ms/

 

HikariPool-1 - Connection is not available, request timed out after 30002ms. - Mkyong.com

- HikariPool-1 - Connection is not available, request timed out after 30002ms.

mkyong.com

 

반응형