問題描述
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 在沒有任何日志或任何堆棧的情況下停止的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!