주제: Tomcat 종료 시 MySQL Cleanup Thread 잔류 문제와 해결 방안
최초 Jenkins 기반 배포 시 SSH 스크립트 배포 진행
./stop.sh 상에서 graceful time 간의 shutdown 을 기다리는데 이 과정에서 모든 Connection 이 종료되지 않으면서 배포 실패 : was not stable
이 후 재배포를 진행하지만 Connection 연결이 거부되면서 배포 진행이 이뤄지지 않음 → Tomcat 은 이전 단계 배포 과정에서 종료되어 있고, JVM 만 살아서 구동되고 있기에
Graceful Shutdown
동안 모든 DB Connection이 종료되지 않음AbandonedConnectionCleanupThread
가 Tomcat 종료 후에도 JVM에 남아있는 문제가 발생Illegal access: this web application instance has been stopped already.
Could not load []. The following stack trace is thrown for debugging purposes
as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1353)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1029)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:90)
shutdown.sh
가 실행되어 Tomcat이 내려가지만,
Graceful Shutdown 시간 내에 모든 Connection이 종료되지 않음.AbandonedConnectionCleanupThread
**가
남은 커넥션을 정리하려고 시도