Jstack hung and cannot capture stack info

562 views Asked by At

My java program hang there and i cannot debug it. Here is what i tried

  1. jstack $pid, hang and never response
  2. jstack -F $pid with /proc/sys/kernel/yama/ptrace_scope == 0. Get errors below
Error: -F option used
Cannot connect to core dump or remote debug server. Use jhsdb jstack instead
  1. Then i tried jhsdb jstack --pid $pid. Still hangs forever and i got
Attaching to process ID 123212, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 11+28
Deadlock Detection:

After i press CTRL+C. I got:

Attaching to process ID 123212, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 11+28
Deadlock Detection:

java.lang.RuntimeException: VM.initialize() was not yet called
    at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VM.getVM(VM.java:460)
    at jdk.hotspot.agent/sun.jvm.hotspot.types.basic.BasicTypeDataBase.findDynamicTypeForAddress(BasicTypeDataBase.java:299)
    at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VirtualBaseConstructor.instantiateWrapperFor(VirtualBaseConstructor.java:102)
    at jdk.hotspot.agent/sun.jvm.hotspot.oops.Metadata.instantiateWrapperFor(Metadata.java:73)
    at jdk.hotspot.agent/sun.jvm.hotspot.oops.MetadataField.getValue(MetadataField.java:43)
    at jdk.hotspot.agent/sun.jvm.hotspot.oops.MetadataField.getValue(MetadataField.java:40)
    at jdk.hotspot.agent/sun.jvm.hotspot.oops.Klass.getNextLinkKlass(Klass.java:131)
    at jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderData.find(ClassLoaderData.java:96)
    at jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderDataGraph.find(ClassLoaderDataGraph.java:61)
    at jdk.hotspot.agent/sun.jvm.hotspot.memory.SystemDictionary.getAbstractOwnableSynchronizerKlass(SystemDictionary.java:116)
    at jdk.hotspot.agent/sun.jvm.hotspot.runtime.DeadlockDetector.print(DeadlockDetector.java:84)
    at jdk.hotspot.agent/sun.jvm.hotspot.runtime.DeadlockDetector.print(DeadlockDetector.java:39)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:62)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.run(JStack.java:67)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
    at jdk.hotspot.agent/sun.jvm.hotspot.tools.JStack.runWithArgs(JStack.java:90)
    at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJSTACK(SALauncher.java:259)
    at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:450)
Can't print deadlocks:VM.initialize() was not yet called
Exception in thread "main" java.lang.RuntimeException: VM.initialize() was not yet called
    at jdk.hotspot.agent/sun.jvm.hotspot.runtime.VM.getVM(VM.java:460)

0

There are 0 answers