OpenJDK17 manual heap dump causes EAP to crash

Solution Verified - Updated -

Issue

  • When attempting to capture a heap dump (/usr/lib/jvm/java-17/bin/jmap -dump:live,format=b,file=heapdump.hprof <APP_PID>), jmap fails with the following error:
Exception in thread "main" java.io.IOException: Premature EOF
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.readInt(HotSpotVirtualMachine.java:341)
        at jdk.attach/sun.tools.attach.VirtualMachineImpl.execute(VirtualMachineImpl.java:197)
        at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:310)
        at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:133)
        at jdk.jcmd/sun.tools.jmap.JMap.dump(JMap.java:248)
        at jdk.jcmd/sun.tools.jmap.JMap.main(JMap.java:114)
  • It causes the JBoss process to crash with the following in the fatal error log:
Current thread (0x000055dc0f466840):  VMThread "VM Thread" [stack: 0x00007f951c826000,0x00007f951c926000] [id=2369242]

Stack: [0x00007f951c826000,0x00007f951c926000],  sp=0x00007f951c924698,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x294324]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<548964ul, G1BarrierSet>, (AccessInternal::BarrierType)2, 548964ul>::oop_access_barrier(void*)+0x4
V  [libjvm.so+0x7fb223]  HeapRegion::object_iterate(ObjectClosure*)+0xc3
V  [libjvm.so+0x71a06b]  IterateObjectClosureRegionClosure::do_heap_region(HeapRegion*)+0x2b
V  [libjvm.so+0x800fc0]  HeapRegionManager::iterate(HeapRegionClosure*) const+0x40
V  [libjvm.so+0x70d40e]  G1CollectedHeap::object_iterate(ObjectClosure*)+0x3e
V  [libjvm.so+0x7ed96e]  VM_HeapDumper::work(unsigned int) [clone .part.156]+0x20e
V  [libjvm.so+0xf7e3df]  WorkGang::run_task(AbstractGangTask*, unsigned int, bool)+0xef
V  [libjvm.so+0x7edf04]  VM_HeapDumper::doit()+0x84
V  [libjvm.so+0xf51f9f]  VM_Operation::evaluate()+0xef
V  [libjvm.so+0xf540c8]  VMThread::inner_execute(VM_Operation*)+0x258
V  [libjvm.so+0xf5453e]  VMThread::loop()+0x12e
V  [libjvm.so+0xf547dc]  VMThread::run()+0x8c
V  [libjvm.so+0xecf963]  Thread::call_run()+0x73
V  [libjvm.so+0xc3e18b]  thread_native_entry(Thread*)+0xeb

Environment

  • JBoss Enterprise Application Platform
    • 7
    • 8
  • OpenJDK17

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content