每次发布项目的时候,tomcat执行shutdown.sh之后,都会打印以下日志,
并且会在linux中开启几个java进程,占了很多内存,找了很久的原因,都不知道怎么处理,希望大佬帮忙解答一下。
四月 02, 2019 1:48:34 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["http-bio-80"]
四月 02, 2019 1:48:34 下午 org.apache.coyote.AbstractProtocol pause
信息: Pausing ProtocolHandler ["ajp-bio-8009"]
四月 02, 2019 1:48:35 下午 org.apache.catalina.core.StandardService stopInternal
信息: Stopping service Catalina
四月 02, 2019 1:48:35 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
严重: The web application [/ShiJie] appears to have started a thread named [pool-1-thread-1] but has failed to stop it. This is very likely to create a memory leak.
四月 02, 2019 1:48:35 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
严重: The web application [/ShiJie] appears to have started a thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak.
四月 02, 2019 1:48:35 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
严重: The web application [/ShiJie] appears to have started a thread named [I/O dispatcher 1] but has failed to stop it. This is very likely to create a memory leak.
四月 02, 2019 1:48:35 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
严重: The web application [/ShiJie] appears to have started a thread named [I/O dispatcher 2] but has failed to stop it. This is very likely to create a memory leak.
四月 02, 2019 1:48:35 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
jmap、jstack、jstat工具用法了解下
你怎么开了多个进程,ps查看的? 一般showdown.sh会使用single通知关闭,会触发定义的钩子函数 ShutdownHook定义的逻辑,会做一些释放资源的工作.
打个比方: 一个web服务当前正在运行,你是执行完当前用户请求关闭服务,还是直接强制关闭(导致逻辑执行一般出现事务或数据操作一致性问题)。
你可以看下shutdown,sh 逻辑基本在 catalina.sh 中实现 ,具体的逻辑下图,试例: tomcat7的版本
kill -15 内核通过 single 通知应用关闭,会触犯 tomcat 的添加的CloseHook释放资源。
具体释放逻辑就要看源码了,也不难,搜索:Runtime.getRuntime().addShutdownHook( {logic} )
查看执行的 logic 就好了
很久没用tomcat了...