tomcat 8.0 进程没有全部杀死

时间:2020-12-01 20:25:24

The web application [FileIO_new_interface] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1c27fa09]) and a value of type [java.lang.Class] (value [class com.cetc.di.io.impl.SayHelloImpl]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. 这个错误是说,网络应用[FileIO_new_interface]创建了一个本地线程,但是在web application停止的时候,没有成功的被清除掉,这可能导致潜在的内存溢出错误,解决办法是手动杀掉相关的进程。方法是通过端口号,通过服务开放的端口号找出进程号,然后杀掉。

...skipping...
sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:68)
org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
17-Nov-2015 17:10:15.936 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [FileIO_new_interface] appears to have started a thread named [New I/O worker #5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:68)
org.jboss.netty.channel.socket.nio.AbstractNioSelector.select(AbstractNioSelector.java:409)
org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90)
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
17-Nov-2015 17:10:15.937 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [FileIO_new_interface] appears to have started a thread named [New I/O server boss #6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
org.jboss.netty.channel.socket.nio.NioServerBoss.select(NioServerBoss.java:163)
org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:206)
org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
17-Nov-2015 17:10:15.938 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [FileIO_new_interface] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1c27fa09]) and a value of type [java.lang.Class] (value [class com.cetc.di.io.impl.SayHelloImpl]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
17-Nov-2015 17:10:15.948 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /usr/tomcat/apache-tomcat-8.0.28/webapps/FileIO_new_interface.war has finished in 9,289 ms
17-Nov-2015 17:10:15.950 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/tomcat/apache-tomcat-8.0.28/webapps/ROOT
17-Nov-2015 17:10:15.989 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/tomcat/apache-tomcat-8.0.28/webapps/ROOT has finished in 39 ms

解决办法:

[root@localhost webapps]# ps -ef | grep tomcat
root 772 1 3 17:10 pts/0 00:00:32 /usr/java/jdk1.8.0_65/jre/bin/java -Djava.util.logging.config.file=/usr/tomcat/apache-tomcat-8.0.28/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/tomcat/apache-tomcat-8.0.28/endorsed -classpath /usr/tomcat/apache-tomcat-8.0.28/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-8.0.28/bin/tomcat-juli.jar -Dcatalina.base=/usr/tomcat/apache-tomcat-8.0.28 -Dcatalina.home=/usr/tomcat/apache-tomcat-8.0.28 -Djava.io.tmpdir=/usr/tomcat/apache-tomcat-8.0.28/temp org.apache.catalina.startup.Bootstrap start
root 838 17424 0 17:25 pts/0 00:00:00 grep tomcat
root 17532 1 0 Nov13 pts/0 00:11:54 /usr/java/jdk1.8.0_65/jre/bin/java -Djava.util.logging.config.file=/usr/tomcat/apache-tomcat-8.0.28/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/tomcat/apache-tomcat-8.0.28/endorsed -classpath /usr/tomcat/apache-tomcat-8.0.28/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-8.0.28/bin/tomcat-juli.jar -Dcatalina.base=/usr/tomcat/apache-tomcat-8.0.28 -Dcatalina.home=/usr/tomcat/apache-tomcat-8.0.28 -Djava.io.tmpdir=/usr/tomcat/apache-tomcat-8.0.28/temp org.apache.catalina.startup.Bootstrap start
[root@localhost webapps]# netstat -apn | grep 20880
[root@localhost webapps]# netstat -apn | grep 20151
tcp 0 0 :::20151 :::* LISTEN 17532/java
[root@localhost webapps]# kill -9 17532
[root@localhost webapps]# netstat -apn | grep 20151
[root@localhost webapps]# rm -fr ../logs/catalina.*
[root@localhost webapps]# ls
docs examples FileIO_new_interface FileIO_new_interface.war host-manager manager ROOT
[root@localhost webapps]# rm -fr FileIO_new_interface
[root@localhost webapps]# less ../logs/
host-manager.2015-11-10.log localhost.2015-11-10.log localhost.2015-11-17.log localhost_access_log.2015-11-17.txt manager.2015-11-17.log
host-manager.2015-11-11.log localhost.2015-11-11.log localhost_access_log.2015-11-10.txt manager.2015-11-10.log
host-manager.2015-11-13.log localhost.2015-11-12.log localhost_access_log.2015-11-11.txt manager.2015-11-11.log
host-manager.2015-11-16.log localhost.2015-11-13.log localhost_access_log.2015-11-13.txt manager.2015-11-13.log
host-manager.2015-11-17.log localhost.2015-11-16.log localhost_access_log.2015-11-16.txt manager.2015-11-16.log
[root@localhost webapps]# less ../logs/
host-manager.2015-11-10.log localhost.2015-11-10.log localhost.2015-11-17.log localhost_access_log.2015-11-17.txt manager.2015-11-17.log
host-manager.2015-11-11.log localhost.2015-11-11.log localhost_access_log.2015-11-10.txt manager.2015-11-10.log
host-manager.2015-11-13.log localhost.2015-11-12.log localhost_access_log.2015-11-11.txt manager.2015-11-11.log
host-manager.2015-11-16.log localhost.2015-11-13.log localhost_access_log.2015-11-13.txt manager.2015-11-13.log
host-manager.2015-11-17.log localhost.2015-11-16.log localhost_access_log.2015-11-16.txt manager.2015-11-16.log
[root@localhost webapps]# ls
docs examples FileIO_new_interface FileIO_new_interface.war host-manager manager ROOT
[root@localhost webapps]# netstat -lntpu | grep 8080
tcp 0 0 :::8080 :::* LISTEN 772/java