Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to analyze a truncated Java Heap Dump (hprof file)?

In my work, we are running into a difficult to reproduce OOM issue. Or, more accurately, it is very easy to reproduce on one system, making that system unusable, but difficult to reproduce anywhere else, given the same inputs.

The application is being run as a service using a service wrapper. We did manage to get the configuration changed to launch it with the option of outputting a heap dump file on OOM but, unfortunately, they were truncated, most likely due to the service wrapper timing out and killing the process as it wrote the file. This is readily apparent, since the max memory is set to 1GB, and the hprof files are as small as 700MB, which is too small to be the entire heap upon OOM.

It would take a lot of jumping through hoops to additionally configure the wrapper to give the java process a longer time to write out the heap, but we are pursuing this using these 2 options:

wrapper.jvm_exit.timeout=600
wrapper.shutdown.timeout=600

The question is, is there anything useful I can do with the truncated hprof files I have? Eclipse MAT chokes on them. Jhat appears to load them, but then only shows 3 instances of Java.Object of size 0 and nothing else. I tried YourKit and it couldn't write its oids file.

It seems to me like these files should have some useful, accessible information in them. Is there a tool that can read what's there?

Thank you for your time!

like image 809
user1410910 Avatar asked Jun 16 '17 20:06

user1410910


People also ask

How do I Analyse Hprof files?

In order to analyze the hprof files, there is a tool called Memory Analyzer(MAT) provided by SAP and IBM jointly. You can download latest version from here. In this post, I will try to explain shortly how to analyse the hprof files and OOM (out of memory) issues in BI servers and solve them.

How do I analyze a heap dump file?

If you have a heap dump file saved on your local system, you can open the file in Java VisualVM by choosing File > Load from the main menu. Java VisualVM can open heap dumps saved in the . hprof file format. When you open a saved heap dump, the heap dump opens as a tab in the main window.

What is heap dump Hprof?

A heap dump is a snapshot of all the objects that are in memory in the JVM at a certain moment. They are very useful to troubleshoot memory-leak problems and optimize memory usage in Java applications. Heap dumps are usually stored in binary format hprof files.


1 Answers

Best option for analyzing the dump file which i came across till date, is text editors like vim.

like image 200
Amit Mahajan Avatar answered Oct 06 '22 05:10

Amit Mahajan