Core dump taken with gcore, jmap conversion to hprof file format fails with Error message

白昼怎懂夜的黑 提交于 2019-11-27 14:04:41

By the way, jvisualvm can load core dumps directly. But you must use the same jvm that created the core file.

Heathkit7

Was the core file larger than 2GB? If so, you could be having an issue with the Linux build of libsaproc.so that comes with the JVM.

Run your command again, but like this:

strace -o out.txt -f $yourOriginalCommand

Then 'grep core.2878 out.txt' and look for an error on the open() syscall. Did it return an error (E_XXXXX) or a file handle number?

sfali16

This was bothering the heck out of me as I had a core file that represented a heap that I needed to analyze, but I was constantly seeing the exception message below:

sun.jvm.hotspot.debugger.NoSuchSymbolException: Could not find symbol "gHotSpotVMTypeEntryTypeNameOffset" in any of the known library names (libjvm.so, libjvm_g.so, gamma_g)

Copying the jre from my source machine (the machine where the core file was obtained) on to the exact same folder in the destination machine, and then running jmap with that java location as an argument worked for me.

So here are the steps to try in case someone else runs into this:
1. Connect to the core file through gdb and confirm the location of java binary which the running process was using:

    gdb --core=</path/to/core-file>

2. The above output will end with something like

[New Thread 22748]
**Core was generated by `/opt/blah/location/jre/bin/java -Xmx...'.**

3. Make sure you copy the matching version of the jre into the /opt/blah/location/ directory

  1. Then launch jmap as:

    /opt/jdk1.8.0_09/bin/jmap -heap /opt/blah/location/jre/bin/java /path/to/core-file
    

    This should connect to the core file successfully and print out heap statistics. If it does, then you have successfully read the core file

  2. From that point on, you can generate the hprof from the core file successfully using:

    /opt/jdk1.8.0_09/bin/jmap -dump:format=b,file=my-file.hprof /opt/blah/location/jre/bin/java /path/to/core-file
    
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!