Closing Tomcat VERY Slow After calling shutdown.sh?

My situation is this:

Each time before uploading a war file to a web application folder, I stop Tomcat by calling sh shutdown.sh. It took about 30 seconds to shut down completely. But now it does not work well.

Actually, it worked, because when I access the application from a web page, it gives an error 503 (in the "Maintenance" section). But when I use ps aux | grep tomcatfor verification, the tomcat process still exists. And he will be there for about 5-10 minutes.

I understand that it may take extra time to complete all tasks, but it is too slow (5-10 minutes) before it completely stops. I do not understand why this is happening, but there must be some reason. Maybe something has to do with the code or with the new script deployment we used recently. I just barely know where to check.

This is important for our team, because we use "automatic deployment", in which we use a script to automatically fill the war file, load and deploy at a specific time. If we start a new tomcat instance before the old one is successfully completed, it will hang there forever, and the kill -9 cleanup task is complicated.

Is there anyone who has experimented with this problem? Any key would be appreciated.

+5
source share
2 answers

Hoàng Long -

Thanks for the update.

1) The fact that you see Quartz jobs in progress and an error message is significant:

SEVERE: The web application [/ project] seems to have started a thread named [Resource Destroyer in BasicResourcePool.close ()], but has failed to stop it. This will probably lead to a memory leak.

2) One of the suggestions is the configuration:

http://forum.springsource.org/showthread.php?17833-Spring-Quartz-Tomcat-no-shutdown

I had the same problem. I fixed this by adding destroy-method="destroy"a SchedulerFactoryBean to the definition. Thus, spring closes the scheduler when the application is stopped.

3) Another suggestion is to add a disconnect listener:

http://forums.terracotta.org/forums/posts/list/15/4341.page

. :

  public void contextDestroyed(ServletContextEvent sce) {
    try {
      factory.getScheduler().shutdown();
      Thread.sleep(1000);
+2

All Articles