Reputation: 7523
I am trying to analyse a heap dump taken from a java process that ran into memory issues. The dump was taken using jmap. I am using jhat on the dump file - I am getting
java.io.IOException: Unrecognized magic number: 169897589
at com.sun.tools.hat.internal.parser.Reader.readFile(Reader.java:94)
at com.sun.tools.hat.Main.main(Main.java:159)
Both jdk 1.6 and 1.7 give the same error. I am running the jhat on my Windows machine locally (after copying the dump file over ) and the dump file was taken on Linux server.
Any ideas what I am doing wrong ?
Upvotes: 6
Views: 5625
Reputation: 111
Most probably, you are providing a zip file (.gz or .tar.gz) to the jhat tool. That's why it is not able to verify the hprof header. Recently, I ran across the same situation. My heap dump was captured on a Linux server in .tar.gz format and I supplied as is to get the same error which you got. After untarring the file, jhat was able to analyze the .hprof file.
Upvotes: 0
Reputation: 21
probably, U got the wrong way to generate jvm dump file. the error occurs when using jmap -histo {pid} > dump.log.
try
jmap -dump:live;file=filename pid
Good luck.
Upvotes: 1
Reputation: 5423
If you take a look at the source code for com.sun.tools.hat.internal.parser.Reader, you'll see that it's looking for the magic number 0x4a415641.
This value is used to help identify valid heap dump files. jmap
should append this value as the first four bytes of any heap dump file it creates.
I'd suggest opening up your heap dump in a hex editor and checking to see whether the first four bytes are 0x4a415641
. Check this for the file on both your Linux and Windows machine. Perhaps the file is getting corrupted when you transfer the file.
Upvotes: 5