3

I am trying to convert a Linux core dump of Java process to a heap dump file, suitable for analysing with Eclipse MAT. According to this blog post, adapted to the newer OpenJDK 12, I create a core dump and then run jhsdb jmap to convert the dump to HPROF format:

>sudo gcore -o dump 24934
[New LWP 24971]
...
[New LWP 17921]
warning: Could not load shared library symbols for /tmp/jffi4106753050390578111.so.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f94c7e9e98d in pthread_join (threadid=140276994615040, thread_return=0x7ffc716d47a8) at pthread_join.c:90
90      pthread_join.c: No such file or directory.
warning: target file /proc/24934/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f93756a6000.
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f9379bec000.
...
warning: Memory read failed for corefile section, 1048576 bytes at 0x7f94c82dd000.
Saved corefile dump.24934

> ls -sh dump.24934 
22G dump.24934

> /usr/lib/jvm/zulu-12-amd64/bin/jhsdb jmap --exe /usr/lib/jvm/zulu-12-amd64/bin/java --core dump.24934 --binaryheap --dumpfile jmap-dump.24934
Attaching to core dump.24934 from executable /usr/lib/jvm/zulu-12-amd64/bin/java, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 12.0.1+12
null

> ls -sh jmap-dump.24934 
3.3M jmap-dump.24934

The core dump file is 22 Gb, while heap dump file is just 3 Mb, so it is likely that jhsdb jmap command fails to process the whole core dump. Also Eclipse MAT fails to open the heap dump file with a following message: The HPROF parser encountered a violation of the HPROF specification that it could not safely handle. This could be due to file truncation or a bug in the JVM.

Suryakant Bharti
  • 673
  • 1
  • 6
  • 24
Alex R.
  • 81
  • 1
  • 7

1 Answers1

1

Alex,

There are two possibilities for this.

First, gcore is the handy script of gdb. I see that it prompts some warning messages to say that it has difficulty to load a solib. gdb may generate a broken core file in the first place. You can try to load the core file using gdb and see if it can parse it.

Secondly, jhsdb parses the core file on its own. you can use an environment var LIBSAPROC_DEBUG=1 to get its traces. It will help you to know what's wrong in parsing.

Why don't you dump java heap using jmap -dump directly? This will skip coredump file.

Xin Liu
  • 41
  • 2