tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Thread Dumps/ Emailing Results...
Date Tue, 04 Nov 2008 22:31:35 GMT
Hash: SHA1


Caldarale, Charles R wrote:
>> From: Christopher Schultz []
>> Subject: Re: Thread Dumps/ Emailing Results...
>> I have written a script to check for OOMs by checking catalina.out
>> for "OutOfMemoryError". When such an error is detected, I run the
>> following commands (apologies for the line wrapping):
> An easier way to get the heap dump on a modern HotSpot JVM is to add the command-line
>   -XX:+HeapDumpOnOutOfMemoryError

I noticed that, but we only run our OOM-check every 5 minutes, and we
want to avoid getting too much extra stuff in our email notifications.
If the thread dump happened a few minutes before, then we might not get
an up-to-date thread dump. One could argue that the exact timing of the
thread dump is not particularly relevant; merely having one /is/ useful.
Dumping threads at the time of the OOME would probably be better.

> Also, in JDK 6 and above, there's another intriguing option:
>   -XX:OnOutOfMemoryError="<command>"

That's pretty cool. For the time being, we're on JRE 1.5, so that's not
an option. I'll look into it as we look forward to upgrading.

> The above will run an external command to do whatever you deem
> appropriate, such us running the thread dump script you provided.

It would be great if that command could be parameterized and, say, take
something like the thread dump on standard input. If you know anyone at
Sun, feel free to give them that idea ;)

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message