Tomcat不会停止。我该怎么调试呢? [英] Tomcat doesn't stop. How can I debug this?

查看:507
本文介绍了Tomcat不会停止。我该怎么调试呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux中运行 Tomcat 7 ,我通过 $ CATALINA_HOME / bin / startup.sh 启动关闭通过 $ CATALINA_HOME / bin / shutdown.sh

来自 /etc/init.d

I have a Tomcat 7 running in Linux that I start via $CATALINA_HOME/bin/startup.sh and shutdown via $CATALINA_HOME/bin/shutdown.sh
from /etc/init.d

除1个问题外,一切正常。有时tomcat不会停止。

虽然我停止它,但我看到catalina.out日志正在下降,如果我做 ps -ef 我仍然可以看到进程正在运行。

All is ok except 1 problem. Sometimes tomcat does not stop.
Although I stop it and I see in catalina.out logs that is going down, if I do ps -ef I can still see the process running.

可能是什么问题?我该怎么调试呢?我的感觉是,这与线程有关。

What could be the problem? How can I debug this? My feeling is, that this is related to threads.

所以可疑的部分如下:

1)我使用Log4j的LogManager来检测log4j配置是否已经改变,但是我在 contextDestroyed上执行 Log4jManager.shutdown ServletContextListener

2)我使用 H2 数据库,我在关机时看到:

So the parts that are suspicious are the following:
1) I use Log4j's LogManager to detect if the log4j configuration has been changed, but I do Log4jManager.shutdown on a contextDestroyed ServletContextListener
2) I use H2 database and I see on shutdown:


严重:Web应用程序[/ MyApplication]似乎已经启动了一个名为[H2 Log Writer MYAPPLICATION]的

线程但未能阻止它。

这很可能会创建内存泄漏

SEVERE: The web application [/MyApplication] appears to have started a
thread named [H2 Log Writer MYAPPLICATION] but has failed to stop it.
This is very likely to create a memory leak

严重:Web应用程序[/ MyApplication]似乎已经启动了一个名为[H2 File Lock Watchdog


线程b $ b /opt/myOrg/tomcat/webapps/MyApplication/db/myDatabase.lock.db]但是有
未能阻止它。这很可能造成内存泄漏。 4月2日,

2012 9:08:08 AM org.apache.catalina.loader.WebappClassLoader

clearReferencesThreads严重:网络应用程序[/ MyApplication]

似乎已经启动了一个名为[FileWatchdog]的线程,但是已经失败了
来阻止它。这很可能造成内存泄漏。

SEVERE: The web application [/MyApplication] appears to have started a
thread named [H2 File Lock Watchdog
/opt/myOrg/tomcat/webapps/MyApplication/db/myDatabase.lock.db] but has
failed to stop it. This is very likely to create a memory leak. Apr 2,
2012 9:08:08 AM org.apache.catalina.loader.WebappClassLoader
clearReferencesThreads SEVERE: The web application [/MyApplication]
appears to have started a thread named [FileWatchdog] but has failed
to stop it. This is very likely to create a memory leak.

请帮忙吗?我怎样才能在这里发现问题?

Any help please? How can I detect the problem here?

更新:

我做了 kill -3 正如@daveb和catalina.out所建议的那样,我看到:

UPDATE:
I did a kill -3 as suggested by @daveb, and in the catalina.out I see:


JVMDUMP006I正在处理转储事件user,详情 - 请等待。
JVMDUMP032I JVM使用
'/etc/init.d/javacore.20120402.093922.2568.0001.txt'请求Java转储以响应写入
/ etc的
事件JVMDUMP010I Java转储/init.d/javacore.20120402.093922.2568.0001.txt JVMDUMP013I
已处理的转储事件user,详细信息。

JVMDUMP006I Processing dump event "user", detail "" - please wait. JVMDUMP032I JVM requested Java dump using '/etc/init.d/javacore.20120402.093922.2568.0001.txt' in response to an event JVMDUMP010I Java dump written to /etc/init.d/javacore.20120402.093922.2568.0001.txt JVMDUMP013I Processed dump event "user", detail "".

/etc/init.d 中有一个javacore但我不喜欢不知道如何处理它。即我应该调查哪些部分

There is a javacore in /etc/init.d but I don't know how to process it. I.e. what parts should I investigate

推荐答案

如果Web应用程序已停止,则还应关闭与数据库的所有连接。如果您没有连接列表,则执行SQL语句shutdown(这仅适用于H2和HSQLDB数据库)。

If the web application is stopped, all connections to the database should be closed as well. If you don't have a list of connections, then execute the SQL statement "shutdown" (this only works for the H2 and HSQLDB databases).

如果您有注册了一个Servlet,您可以在 Servlet.destroy()方法中执行此操作。

If you have a registered a Servlet, you can do that in the Servlet.destroy() method.

如果您已注册 ServletContextListener ,则可以在 ServletContextListener.contextDestroyed(ServletContextEvent servletContextEvent)方法。这就是 org.h2.server.web.DbStarter ServletContextListener 是(H2数据库中包含的那个) )。

If you have registered a ServletContextListener, you can execute the "shutdown" statement in the ServletContextListener.contextDestroyed(ServletContextEvent servletContextEvent) method. This is what org.h2.server.web.DbStarter ServletContextListener does (the one that is included in the H2 database).

这篇关于Tomcat不会停止。我该怎么调试呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆