jstack in mixed mode: WrongTypeException: No suitable match for type of address
Asked Answered
P

3

7

I'm trying to run jstack on ubuntu in mixed mode:

 $ jstack -m 7219     

The result is this exception:

Attaching to process ID 7219, please wait...
Debugger attached successfully.
Server compiler detected.
  JVM version is 25.162-b12
  Exception in thread "main" java.lang.reflect.InvocationTargetException
    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:498)
    at sun.tools.jstack.JStack.runJStackTool(JStack.java:140)
    at sun.tools.jstack.JStack.main(JStack.java:106)
 Caused by: java.lang.RuntimeException: Unable to deduce type of thread from address 0x00007f02cc002800 (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)
    at sun.jvm.hotspot.runtime.Threads.createJavaThreadWrapper(Threads.java:166)
    at sun.jvm.hotspot.runtime.Threads.first(Threads.java:150)
    at sun.jvm.hotspot.tools.PStack.initJFrameCache(PStack.java:200)
    at sun.jvm.hotspot.tools.PStack.run(PStack.java:71)
    at sun.jvm.hotspot.tools.PStack.run(PStack.java:58)
    at sun.jvm.hotspot.tools.PStack.run(PStack.java:53)
    at sun.jvm.hotspot.tools.JStack.run(JStack.java:66)
    at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
    at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
    at sun.jvm.hotspot.tools.JStack.main(JStack.java:92)
    ... 6 more
  Caused by: sun.jvm.hotspot.types.WrongTypeException: No suitable match for type of address 0x00007f02cc002800
    at sun.jvm.hotspot.runtime.InstanceConstructor.newWrongTypeException(InstanceConstructor.java:62)
    at sun.jvm.hotspot.runtime.VirtualConstructor.instantiateWrapperFor(VirtualConstructor.java:80)
    at sun.jvm.hotspot.runtime.Threads.createJavaThreadWrapper(Threads.java:162)
    ... 16 more

The process with PID 7219 was started with the same user as jstack.

Politics answered 27/3, 2018 at 15:13 Comment(3)
This can be either a bug in HotSpot Serviceability Agent or an attempt to get a stacktrace while JVM is in inconsistent state. In both cases you can hardly do anything about it.Cordie
Why do you want -m mode? If you are interested in non-Java stack, then gdb should be a better tool for this.Cordie
I'm observing long running requests in a web application. Threaddumps point at native classloading methods. My question in #49508481 lead to this tooling issue.Politics
C
2

I've had the same issue on Ubuntu, with openjdk-9-jdk-headless installed, jstack alone would work fine but jstack -m would fail with same error as you.

Installing openjdk-9-dbg (package that brings debug symbols) solved it.

Catlin answered 12/7, 2018 at 16:19 Comment(1)
Exactly the same issue: jstack without the mixed mode flag is running fine. But i'm using Oracle jdk 1.8.0_172.Politics
E
0

The same user is fine, but make also sure you are using the jstack that is bundled the exact same JVM as the one that is running the process 7219.

Epimenides answered 12/7, 2018 at 12:12 Comment(1)
Thank you for the hint. I'm using the jstack of the jvm which runs the process.Politics
C
0

I had the same problem when using HSDB on openjdk-8. Installing lib sudo apt-get install openjdk-8-dbg works.

Compressibility answered 13/11, 2021 at 15:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.