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

前端 未结 3 1855
抹茶落季
抹茶落季 2020-12-03 07:45

We recently had one of our JVM\'s crash, leaving behind a core dump file produced by the gcore command. We want to have a look at the contents of the file and find out exact

3条回答
  •  心在旅途
    2020-12-03 08:12

    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=
    

    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
      

提交回复
热议问题