垃圾收集器第一和JMap EOF错误

vkr*_*ser 10 java jmap heap-dump

我们正在研究客户端的生产服务器堆,以检测和解决内存泄漏问题.为此,我们定期使用jmap来收集必要的信息.

但是上周我们无法进行转储,因为它触发了EOF错误并关闭了Tomcat实例.

我在互联网上搜索,但找不到有关此错误的任何具体信息.我们检测到只有在使用Gc First垃圾收集器算法时才会发生.

这是我们用来执行jmap的命令行:

jmap -dump:format=b,file=heap.bin <PID>

服务器上的Java版本:JDK 1.7.0_7 x64

有没有人遇到过这种错误?可能缺少一些配置或需要java/jmap的补丁.

UPDATE

我们收集的有关此错误的更多信息:

[root]# jmap -dump:format=b,file=heap.bin 7806
    Dumping heap to /tmp/heap.bin ...
    Exception in thread "main" java.io.IOException: Premature EOF
        at sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:244)
        at sun.tools.attach.LinuxVirtualMachine.execute(LinuxVirtualMachine.java:193)
        at sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:213)
        at sun.tools.attach.HotSpotVirtualMachine.dumpHeap(HotSpotVirtualMachine.java:180)
        at sun.tools.jmap.JMap.dump(JMap.java:241)
        at sun.tools.jmap.JMap.main(JMap.java:140)
[root]#
Run Code Online (Sandbox Code Playgroud)

注意:目标目录有超过500GB的可用空间

错误输出到catalina.out(JVM转储错误):

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f0269cc41c6, pid=7806, tid=139647231129360
#
# JRE version: Java(TM) SE Runtime Environment (7.0_40-b43) (build 1.7.0_40-b43)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.0-b56 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x58c1c6]  DumperSupport::dump_field_value(DumpWriter*, char, unsigned char*)+0x1c6
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/tomcat6/bin/hs_err_pid7806.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
Run Code Online (Sandbox Code Playgroud)

Ste*_*hen 3

我可以通过使用一些附加选项来解决该问题。

java版本“1.7.0_45”。

Java 进程配置了第一个垃圾收集算法:-XX:+UseG1GC

jmap -J-d64 -dump:live,format=b,file=<heap_dump_filename> <PID>
Run Code Online (Sandbox Code Playgroud)