【问题标题】:Extracting Heap-dump (hprof) from Core-dump从核心转储中提取堆转储 (hprof)
【发布时间】:2017-01-20 07:27:02
【问题描述】:

目前我有一个核心转储文件,我想提取堆转储文件。无论我尝试什么,我总是收到以下错误消息:

god@heaven:~$ sudo /opt/java-MyApp/bin/jmap -dump:format=b,file=my-file.hprof /opt/java-MyApp/bin/java /home/god/tmp/core
[sudo] password for god: 
Attaching to core /home/god/tmp/my-app-core-dump from executable /opt/java-MyApp/bin/java, please wait...
Error attaching to core file: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process)
sun.jvm.hotspot.debugger.DebuggerException: Doesn't appear to be a HotSpot VM (could not find symbol "gHotSpotVMTypes" in remote process)
    at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:411)
    at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
    at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:156)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
    at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
    at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at sun.tools.jmap.JMap.runTool(JMap.java:201)
    at sun.tools.jmap.JMap.main(JMap.java:130)

如果我尝试用 gdb 打开核心,它就像一个魅力:

gdb --core core
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
[New LWP 11241]
[New LWP 11242]
[New LWP 11243]
[New LWP 11244]
[New LWP 11245]
...
[New LWP 23423]
[New LWP 30560]
[New LWP 11240]
Core was generated by `/opt/java-MyApp/bin/java -Djava.util.logging.config.file=/opt/MyAp'.
#0  0x0000003c838cc0a6 in ?? ()
[Current thread is 1 (LWP 11241)]
(gdb) 

从我阅读的所有内容来看,我应该确保将 JVM 安装在使用 {{gcore}} 完成核心转储时所拥有的相同路径和版本上。完成后我需要做的就是调用 jmpa 与那个确切的 jvm:

sudo $JVM_USED_WHILE_GCORE_HOME/bin/jmap -dump:format=b,file=$OUTPUT_HPROF_FILE $JVM_USED_WHILE_GCORE_HOME/bin/java $CORE_FILE_PATH

我有什么遗漏吗?为什么我不断收到“在远程进程中找不到符号“gHotSpotVMTypes””错误消息?

【问题讨论】:

  • gdb下,能找到gHotSpotVMTypes符号吗?
  • 不是所有的 OpenJDK 版本吗?或者我可以检查什么?
  • 在gdb下输入p gHotSpotVMTypes
  • 我得到:No symbol table is loaded. Use the "file" command.
  • 如果我这样做 (gdb) file ~/Apps/jdk1.8.0_102/bin/java 我会得到 Reading symbols from ~/Apps/jdk1.8.0_102/bin/java...(no debugging symbols found)...done.

标签: java jvm coredump jvm-hotspot heap-dump


【解决方案1】:

问题很简单。 /opt/java-MyApp/bin/java 路径是 symlink,一旦我像在用于生成核心转储的机器上那样重新创建了结构,它就像一个魅力一样工作。似乎这些库被其规范路径使用。

【讨论】:

    猜你喜欢
    • 2014-09-12
    • 2017-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-11
    • 1970-01-01
    相关资源
    最近更新 更多