问题描述
在运行我的webapp一段时间后(根据流量不同,时间在几个小时和几天之间变化)Tomcat看似随机关闭。在这种情况发生之前,日志中没有什么特别之处(没有例外),只是我的应用发出的正常信息。
任何人都可以帮助解决这个问题吗? Tomcat中是否有触发 AbstractProtocol暂停
信号的任何内容?
日志:
2011年11月9日21:40: 19 org.apache.coyote.AbstractProtocol暂停
INFO:暂停ProtocolHandler [http-bio-80]
09-Nov-2011 21:40:20 org.apache.coyote.AbstractProtocol暂停
信息:暂停ProtocolHandler [ajp-bio-8009]
09-Nov-2011 21:40:21 org.apache.catalina.core.StandardService stopInternal
信息:停止服务Catalina
Java版本:1.6.0_25-b06
Tomcat版本:6
我以前见过这种情况,日志可能有时候很神秘。我注意到,虽然你在80端口上运行(这是另一个问题),这让我相信你修改了server.xml。如果服务器上有多个tomcat实例,请确保它们都具有唯一的关闭端口。标准端口是8005,如果多个实例在同一个端口上侦听,可以将它们都关闭。
可能有一个随机的System.exit()in您的代码或杠杆库中,或者您不正确地抑制代码中的真实错误消息。我已经看到很多次,人们在控制器中将它写成错误处理的形式:
try {
//做一些事情
} catch(Exception e){
//不重新抛出或记录,只是压制
}
这样可以避免冒泡或甚至正确记录的真正错误。
我也看到tomcat服务器停止运行当他们达到记忆极限时。在日志的某个地方会有一个Heap Space错误,但由于某种原因,我发现它可以很容易地被埋起来,所有剩下的就是暂停信息。除了catalina.out之外,可能还需要查看localhost.log。那里通常有更少的垃圾。
After running my webapp for a while (timing varies between hours and days depending on traffic) Tomcat seemingly randomly shuts itself down. There's nothing out of the ordinary in the log before this happens (no exceptions) just normal INFO stuff that my app emits.
Can anyone help on how best to debug this? Is there anything in Tomcat that would trigger the AbstractProtocol pause
signal?
Logs:
09-Nov-2011 21:40:19 org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-80"]
09-Nov-2011 21:40:20 org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
09-Nov-2011 21:40:21 org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Java version: 1.6.0_25-b06Tomcat version:6
I've seen this happen before and the logs can be sometimes cryptic. I do notice though that you're running on Port 80 (which is a whole other issue) which leaves me to believe you modified your server.xml. If there are multiple tomcat instances on the server ensure they all have unique shutdown ports. The standard port is 8005 and if multiple instances are listening on the same port it is possible to take them both down.
There could be a random System.exit() in your code or in a leveraged library or you are improperly suppressing the true error message in your code. I've seen it plenty of times that people write this in controllers as a form of error handling:
try {
// Do something
} catch(Exception e) {
// No rethrowing or logging, just suppressing
}
This keeps the true error from bubbling up or even proper logging.
I have also seen tomcat servers just stop functioning when they hit memory limits. There will be a Heap Space error somewhere in the logs but for some reason I find it can get buried pretty easily and all that will be left will be the pause messages. It might be worthwhile to look in the localhost.log besides from the catalina.out. There's usually less garbage in there.
这篇关于在轻度使用后,Tomcat随即停用AbstractProtocol并暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!