問題描述
Tomcat 5.5 有問題,它在我們的生產(chǎn)服務(wù)器(Linux CentOS 4.8)上晚上停止,我們不知道它為什么停止......catalina.out 或任何應(yīng)用程序的日志中都沒有 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.
我們嘗試了不同的方法來找出服務(wù)器停止的原因:
We tried different things to find why the server stops:
- 配置 Tomcat 以生成核心轉(zhuǎn)儲(chǔ)
- 使用 javassist 檢測
System.exit()
方法以查找該方法是否被調(diào)用 - 向 JVM 添加關(guān)閉掛鉤(使用
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()
)
它們都不起作用,我們沒有核心轉(zhuǎn)儲(chǔ),沒有調(diào)用 Exit 方法和關(guān)閉掛鉤.我的結(jié)論是:
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 被重定向到哪里,并檢查那里是否打印了任何內(nèi)容.
1) Make sure you know where stderr is redirected and check if anything got printed there.
2) 檢查 Tomcat 的內(nèi)存限制以及系統(tǒng)有多少可用內(nèi)存.查看/var/log 下的 Linux 系統(tǒng)日志,看看在此期間是否發(fā)生了任何可疑的事情.例如,如果系統(tǒng)內(nèi)存不足,內(nèi)核可以(幾乎)不留痕跡地隨機(jī)殺死一個(gè)進(jìn)程.
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,我們多年來一直在生產(chǎn) 5.5,從未發(fā)生過任何無法解釋的停機(jī).
We've ran 5.5 in production for years and never had any unexplained shutdowns, FWIW.
這篇關(guān)于Tomcat 在沒有任何日志或任何堆棧的情況下停止的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!