问题描述
Tomcat 5.5 有问题,它在我们的生产服务器(Linux CentOS 4.8)上晚上停止,我们不知道它为什么停止......catalina.out 或任何应用程序的日志中都没有 Tomcat 的日志.
We have trouble with Tomcat 5.5 which stops at night on our production servers (Linux CentOS 4.8) and we have no idea why it stops... There is no Tomcat's log in catalina.out or any application's log.
我们尝试了不同的方法来找出服务器停止的原因:
We tried different things to find why the server stops:
- 配置 Tomcat 以生成核心转储
- 使用 javassist 检测
System.exit()
方法以查找该方法是否被调用 - 向 JVM 添加关闭挂钩(使用
Runtime.getRuntime().addShutdownHook()
)
- configure Tomcat to be able to generate a core dump
- instrument
System.exit()
method with javassist to find if the method was called - add a shutdown hook to the JVM (with
Runtime.getRuntime().addShutdownHook()
)
它们都不起作用,我们没有核心转储,没有调用 Exit 方法和关闭挂钩.我的结论是:
None of them worked, we have no core dump, the Exit method and the shutdown hook are not called. My conclusions are:
- VM 未正确终止,但没有任何日志而崩溃.
有什么想法或日志可以阅读以找出 Tomcat 停止的原因吗?
Any idea or log to read to find why Tomcat stops?
推荐答案
1) 确保你知道 stderr 被重定向到哪里,并检查那里是否打印了任何内容.
1) Make sure you know where stderr is redirected and check if anything got printed there.
2) 检查 Tomcat 的内存限制以及系统有多少可用内存.查看/var/log 下的 Linux 系统日志,看看在此期间是否发生了任何可疑的事情.例如,如果系统内存不足,内核可以(几乎)不留痕迹地随机杀死一个进程.
2) Check the memory limits on Tomcat and how much free memory does the system have. Review the Linux system logs under /var/log to see if anything suspicious happened during the time. For example, kernel can randomly kill a process (almost) without a trace if the system is running low on memory.
FWIW,我们多年来一直在生产 5.5,从未发生过任何无法解释的停机.
We've ran 5.5 in production for years and never had any unexplained shutdowns, FWIW.
这篇关于Tomcat 在没有任何日志或任何堆栈的情况下停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!