tomcat 项目没部署上去_tomcat卸载部署项目内存不释放

在尝试部署和卸载Tomcat项目时,发现内存占用从1217增加到2337,即使项目卸载后内存并未释放。日志显示JDBC驱动已强制注销,但仍存在线程警告可能导致内存泄漏。调整了server.xml和catalina.sh中的配置,但内存占用仍然增加,可能导致Tomcat内存溢出,需要进一步排查内存泄漏原因。
摘要由CSDN通过智能技术生成

使用tomcat的应用管理页面进行项目管理

b21456ca06b6643ddd102a2a6b14bac2.png

5d852f8cbb39ed5ab91b766a3ae9699b.png

服务器中tomcat占用的内存是1217

部署一个项目

8ecb51174f47f83f7aefed1c25cd69c2.png

部署完成

297669409cdd370638098463ce953b65.png

内存占用2337

98160d635623606ce143bbf0d4b0362c.png

然后将项目卸载

180a2fd0e24ec6ce9afab353b314372d.png

控制台打印的日志

[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)

5b37625bd02072ddb32ad6c4adfb5754.png

tomcat显示项目卸载完成

查看服务器内存占用

1bc1ea54185b4eb77b1610fc9877e78d.png

内存没有进行释放

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,

实在是找不到哪里的问题,哪位大神能帮忙提示一下!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值