Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Monday, 10 March 2008

Java 5 Trouble-Shooting and Diagnostic Guide

For record: Java TM 2 Platform, Standard Edition 5.0 Trouble-Shooting and Diagnostic Guide A very good but hidden description of hacking tools and methods useful when dealing with JVM problems.

Thursday, 28 February 2008

java and OOME

Just for record. Java is absolutely unstable OutOfMemoryError. In multi threaded app you can't even do a System.exit(whatever). Because it tries to do various thing like run finalize and whatever it does it can hang up application.

If that's a server like app that can be restated by some process monitor one can use following jvm parameters:

-XX:OnOutOfMemoryError="kill -9 %p"
on unix or
"-XX:OnOutOfMemoryError=taskkill /F /PID %p"
on win32 to kill your process forcefully in case OOME.

One useful option is also -XX:+HeapDumpOnOutOfMemoryError which dumps whole heap into file before it croaks on OOME. You can analyze this dump with jhat tool that can be found in jdk1.6.0.

Related links: