Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java webstart heap dump

I have been trying to get webstart to dump to a heap dump when it runs out of memory.

I know the jmap/jconsole way of doing it, but what I really want to do is add the option to jnlp file and have tried the following options.

  1. j2se version="1.6+" java-vm-args="-server +HeapDumpOnOutOfMemoryError" max-heap-size="768M"
  2. j2se version="1.6+" java-vm-args="-server -XX:+HeapDumpOnOutOfMemoryError" max-heap-size="768M"
like image 661
benjipete Avatar asked Jan 11 '11 23:01

benjipete


People also ask

What does Java webstart do?

The Java Web Start software allows you to download and run Java applications from the web. The Java Web Start software: Provides an easy, one-click activation of applications. Guarantees that you are always running the latest version of the application.


2 Answers

According to Java 7 Release Notes, the -XX:+HeapDumpOnOutOfMemoryError option is now supported for a webstart application (RFE: 6664424).

like image 167
Nico Avatar answered Oct 10 '22 02:10

Nico


It will definetly not work when you place this option to the jnlp file. There is a list of allowed options and the others will be ignored. You can check the list of available JVM options in the documentation.

Note that the idea is that end-user will run you application on his computer. What would you do with the heap dump on his comp? It might be anyone in the world running your app. It won't make much sense if you were allowed to do this with end users JVM through your JNLP file.

The only situation I can think about would be you have access to that computer and you can check the dump later. In that case (you as a end user request the dump) it is actually possible if you bypass the autorun of the jnlp file from the browser and run it yourself via the javaws command. The steps I have taken and which lead to success were as follows (assume the jnlp file was testOOM.jnlp and you are on windows):

  1. Download the JNLP file
  2. from the command line navigate to the directory with the JNLP file
  3. execute javaws -verbose -J-XX:+HeapDumpOnOutOfMemoryError testOOM.jnlp

Using this the app will be launched in the very same way as from the browser. But notice the -J option which allows you to supply JVM options to the JVM. This is ok because it is the ebd user client who requested the dump.

On OutOfMemoryError the heap dump will be stored in the same directory where you run your javaws command from.

like image 27
Jan Zyka Avatar answered Oct 10 '22 02:10

Jan Zyka