views:

745

answers:

2

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

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

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.

OS is Windows 2003.

Java version is 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).

The dumps mostly contained errors such as:

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

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.

+1  A: 

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

  • 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.
Thorbjørn Ravn Andersen
Thanks for your response.For now I've ruled out hardware faults, as the problem occurs on many different servers.The OS is Windows XP which does not seem to have any CPU usage limits (?)I will see if I can downgrade the Java version, and am still trying to figure out how to disable Tomcat native code.
Jonathan Maddison
Could you provide any more detail about the "subtle functionality" which is broken in Java 6?
Jonathan Maddison
I cannot recall the exact details but I had something - Java WebStart I think - which was fixed in a later release of Java 6. You may have something similar, as there has been a large internal reworking around Java 6 update 10 which just hasn't been caught yet. Hence the suggestion to try with Java 5.Also note that you have other options. Both IBM and Oracle have their own JVM which might be worth checking. Also other Web Containers exist. Depending on your needs Jetty, Glassfish or Geronimo could be replacements.
Thorbjørn Ravn Andersen
+1  A: 

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.

steve
Is this true also on Windows XP? I have been looking into making configuration changes to get such a dump, but if one was created by default that would be excellent.
Jonathan Maddison
Yes, it is the same for windows. Check the "Startup and Recovery" settings
steve