java 调试tomcat崩溃

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1575730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 17:08:56  来源:igfitidea点击:

debugging tomcat crash

javadebuggingtomcat

提问by Jonathan Maddison

I have an instance of Tomcat which periodically crashes for unknown reasons.

我有一个 Tomcat 实例,由于未知原因,它会定期崩溃。

There are no errors left in the logs, only a line in Event Viewer saying "Tomcat terminated unexpectedly".

日志中没有留下任何错误,事件查看器中只有一行说“Tomcat 意外终止”。

In a test environment I have been unable to replicate the issue. I am therefore mostly restricted to passive monitoring of the production environment.

在测试环境中,我无法复制该问题。因此,我主要限于对生产环境进行被动监控。

The problem does not seem to be related to memory as the unexpected terminations show no obvious correlation to the process' memory usage.

该问题似乎与内存无关,因为意外终止与进程的内存使用没有明显的相关性。

What steps could I take to further diagnose this problem?

我可以采取哪些步骤来进一步诊断此问题?

EDIT:

编辑:

Some corrections/clarifications:

一些更正/澄清:

It is actually not a single "instance" of Tomcat, rather several instances with similar configurations.

它实际上不是Tomcat的单个“实例”,而是具有相似配置的多个实例。

OS is Windows 2003.

操作系统是 Windows 2003。

Java version is Java 6.

Java 版本是 Java 6。

UPDATE:

更新:

Looks like the issue might be related to memory after all. Discovered some crash dumps which were created in the Tomcat directory (not .../Tomcat/logs).

看起来这个问题毕竟可能与内存有关。发现了一些在 Tomcat 目录(不是 .../Tomcat/logs)中创建的故障转储。

The dumps mostly contained errors such as:

转储主要包含错误,例如:

java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?

java.lang.OutOfMemoryError:为 ChunkPool::allocate 请求了 32756 字节。交换空间不足?

This is unexpected as the process sometimes crashed when it's memory usage was a relatively low point (compared to historical usage).

这是出乎意料的,因为当内存使用量相对较低时(与历史使用量相比),进程有时会崩溃。

In all dumps, perm gen space is at 99% usage, but in absolute terms this usage is not consistent, and is nowhere near the limit specified in -XX:MaxPermSize.

在所有转储中,永久生成空间的使用率为 99%,但从绝对意义上讲,此使用情况并不一致,并且远不及 -XX:MaxPermSize 中指定的限制。

采纳答案by Thorbj?rn Ravn Andersen

This indicates to me that the whole JVM crashed, which is a rather unusual thing. I would consider the following steps:

这向我表明整个 JVM 崩溃了,这是一件相当不寻常的事情。我会考虑以下步骤:

  • First check the hardware is ok. Run memtest86+ - http://www.memtest86.com/or on a Ubuntu cd - to test the memory. Let it run a while to be absolutely certain.
  • Then see if the version of Java you use, is ok. Some versions of Java 6 broke some subtle functionality. The latest Java 5 might be a good solution at this point.
  • Disable the Tomcat native code to improve performance. There is a native library which Tomcat uses for something. Since you have a crashing JVM, getting rid of native code is a very good start.
  • See if there is some restrictions in the version of Windows you use. A cpu usage limit before termination, or any other quota.
  • 首先检查硬件是否正常。运行 memtest86+ - http://www.memtest86.com/或在 Ubuntu cd - 测试内存。让它运行一段时间以绝对确定。
  • 然后看看你使用的Java版本是否可以。Java 6 的某些版本破坏了一些微妙的功能。在这一点上,最新的 Java 5 可能是一个很好的解决方案。
  • 禁用 Tomcat 本机代码以提高性能。有一个 Tomcat 用于某些东西的本机库。由于您有一个崩溃的 JVM,因此摆脱本机代码是一个非常好的开始。
  • 查看您使用的Windows 版本是否有一些限制。终止前的 CPU 使用限制或任何其他配额。

回答by steve

Generally if a process crashes in windows, a dump file is created. Load the dump file in windbg (windows debugger) and get a stack trace of the thread that caused the exception. This should give you a better idea what the problem is.

通常,如果 Windows 中的进程崩溃,则会创建转储文件。在 windbg(Windows 调试器)中加载转储文件并获取导致异常的线程的堆栈跟踪。这应该让您更好地了解问题所在。