使用tomcat的应用管理页面进行项目管理
服务器中tomcat占用的内存是1217
部署一个项目
部署完成
内存占用2337
然后将项目卸载
控制台打印的日志
[INFO] [2021-01-21 13:58:35] org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.shutdown(208) | Shutting down ExecutorService 'taskScheduler'
[INFO] [2021-01-21 13:58:35] org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.shutdown(208) | Shutting down ExecutorService 'applicationTaskExecutor'
[INFO] [2021-01-21 13:58:35] org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.destroy(597) | Closing JPA EntityManagerFactory for persistence unit 'primaryPersistenceUnit'
[INFO] [2021-01-21 13:58:35] com.zaxxer.hikari.HikariDataSource.close(350) | HikariPool-2 - Shutdown initiated...
[INFO] [2021-01-21 13:58:35] com.zaxxer.hikari.HikariDataSource.close(352) | HikariPool-2 - Shutdown completed.
21-Jan-2021 13:58:35.116 WARNING [http-nio2-8080-exec-16] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [zaixun_admin] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
21-Jan-2021 13:58:35.116 WARNING [http-nio2-8080-exec-16] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [zaixun_admin] appears to have started a thread named [mysql-cj-abandoned-connection-cleanup] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:85)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
21-Jan-2021 13:58:35.638 INFO [http-nio2-8080-exec-16] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/zaixun_admin]
21-Jan-2021 13:58:38.491 INFO [mysql-cj-abandoned-connection-cleanup] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading 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. 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.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1378)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1030)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:117)
at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:84)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
tomcat显示项目卸载完成
查看服务器内存占用
内存没有进行释放
tomcat apache-tomcat-one/conf/server.xml 中
<Connector executor="tomcatThreadPool" port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol"
connectionTimeout="20000"
redirectPort="8443" enableLookups="false" maxPostSize="-1" URIEncoding="UTF-8" acceptCount="150" acceptorThreadCount="2" disableUploadTimeout="true" maxConnections="10000" SSLEnabled="false"/>
配置了这个,
apache-tomcat-one/bin/catalina.sh中
JAVA_OPTS="-Dfile.encoding=UTF-8-server -Xms512m -Xmx3072m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m -XX:MaxTenuringThreshold=10 -XX:NewRatio=2 -XX:SurvivorRatio=4"
加了这个配置,但部署项目卸载项目还是会导致内存占用不断增加,直到达到tomcat限制的内存大小会导致tomcat内存溢出,得重启tomcat,
实在是找不到哪里的问题,哪位大神能帮忙提示一下!!!