🧠 기술 적용 구조 논의

주제: Tomcat 종료 시 MySQL Cleanup Thread 잔류 문제와 해결 방안


📌 목차


1. 📖 배경

  1. 최초 Jenkins 기반 배포 시 SSH 스크립트 배포 진행

    image.png

  2. ./stop.sh 상에서 graceful time 간의 shutdown 을 기다리는데 이 과정에서 모든 Connection 이 종료되지 않으면서 배포 실패 : was not stable

    image.png

  3. 이 후 재배포를 진행하지만 Connection 연결이 거부되면서 배포 진행이 이뤄지지 않음 → Tomcat 은 이전 단계 배포 과정에서 종료되어 있고, JVM 만 살아서 구동되고 있기에

    image.png

1-1. 오류 현상

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)

1-2. 오류 분석