[Resolved] Tomcat Hangs while Stopping - DevDummy

Latest

Views | Thoughts | Concepts | Techniques

Friday, November 10, 2017

[Resolved] Tomcat Hangs while Stopping





When it is trying to stop Apache Tomcat gracefully, it is often noticed that it starts to hang throwing a error such as follows,

org.apache.catalina.startup.HostConfig.deployWARs Error waiting for multi-thread deployment of WAR files to complete
 java.lang.InterruptedException
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:404)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:744)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:407)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1595)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1164)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1388)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1392)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1360)
at java.lang.Thread.run(Thread.java:748)


Cause of the Issue

Upon multiple war files deployment, Tomcat used multi-threaded behavior where one or multiple threads are waiting on an ongoing or background task to be completed.

However, the threads are not recovered even waited for a sometime, so we need to forcefully terminated the process. 

Resolution

Execute the following command,

[admin@devdummy]ps -ef | grep catalina

XXXX   7568  8689  2 06:00 pts/1    00:17:54 /xxxx/xxxx/jdk1.8.0_141/bin/java -Djava.util.logging.config.file=/xxxx/xxxx/apache-tomcat-8.5.9/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /xxxx/xxxx/apache-tomcat-8.5.9/bin/bootstrap.jar:/xxxx/xxxx/apache-tomcat-8.5.9/bin/tomcat-juli.jar -Dcatalina.base=/xxxx/xxxx/apache-tomcat-8.5.9 -Dcatalina.home=/xxxx/xxxx/apache-tomcat-8.5.9 -Djava.io.tmpdir=/xxxx/xxxx/apache-tomcat-8.5.9/temp org.apache.catalina.startup.Bootstrap start

Here the 7568 is the process id of the tomcat job, so we can directly terminate it.

[admin@devdummy]$ kill -9 7568

References


CheatSheet Suggested


No comments:

Post a Comment