Bug 1571375

Summary: Java devel tools fails the native attach
Product: [Fedora] Fedora Reporter: Attila Fazekas <afazekas>
Component: java-1.8.0-openjdkAssignee: Deepak Bhole <dbhole>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: afazekas, ahughes, dbhole, jerboaa, jvanek, msrb, mvala, omajid, sgehwolf
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-25 10:04:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Attila Fazekas 2018-04-24 15:50:08 UTC
Description of problem:


Version-Release number of selected component (if applicable):
java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-1.b10.fc27.x86_64/jre/bin/java)

How reproducible:
always

Steps to Reproduce:
1. start java process
jstack  -J-d64 -l -m `jps | awk '/Sleep/{print $1}' `
3.

Actual results:
Attaching to process ID 2194464, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.171-b10
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 0x00007fbab40df1b0 (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)
	at sun.jvm.hotspot.runtime.Threads.createJavaThreadWrapper(Threads.java:169)
	at sun.jvm.hotspot.runtime.Threads.first(Threads.java:153)
	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 0x00007fbab40df1b0
	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:165)


Expected results:
Attaching to process ID 2202449, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.171-b11
Deadlock Detection:

No deadlocks found.


Additional info:
I have also issue with core dumps, but I do not have similar issue
with the Sun/Oracle jdk. 

$ file /usr/java/jdk1.8.0_171-amd64/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-1.b10.fc27.x86_64/jre/bin/java: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=68ff4a7f7df79aed78714c7ba6763692d9f784f0, stripped

$ file /usr/java/jdk1.8.0_171-amd64/bin/java
/usr/java/jdk1.8.0_171-amd64/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, BuildID[sha1]=c90f19ee0af98c47ccaa7181853cfd14867bc931, not stripped

I have the spitted debuginfo installed.

Comment 1 Severin Gehwolf 2018-04-25 07:47:03 UTC
Which packages do you have installed exactly? Output of:

$ rpm -qa | grep java-1.8.0-openjdk

Also, which debuginfo packages do you have installed? You'd need debuginfo for java-1.8.0-openjdk and java-1.8.0-openjdk-headless.

$ rpm -qa | grep java-1.8.0-openjdk | grep debuginfo
java-1.8.0-openjdk-headless-debuginfo-1.8.0.171-1.b10.fc27.x86_64
java-1.8.0-openjdk-debuginfo-1.8.0.171-1.b10.fc27.x86_64

With that I have:

$ jstack -J-d64 -l -m 5629
Attaching to process ID 5629, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.171-b10
Deadlock Detection:

No deadlocks found.

----------------- 5631 -----------------
Locked ownable synchronizers:
    - None
----------------- 5635 -----------------
----------------- 5636 -----------------
----------------- 5637 -----------------
----------------- 5638 -----------------
----------------- 5639 -----------------
----------------- 5640 -----------------
----------------- 5641 -----------------
----------------- 5642 -----------------
----------------- 5643 -----------------
----------------- 5644 -----------------
Locked ownable synchronizers:
    - None
----------------- 5645 -----------------
Locked ownable synchronizers:
    - None
----------------- 5646 -----------------
Locked ownable synchronizers:
    - None
----------------- 5647 -----------------
Locked ownable synchronizers:
    - None
----------------- 5648 -----------------
Locked ownable synchronizers:
    - None
----------------- 5649 -----------------
Locked ownable synchronizers:
    - None
----------------- 5650 -----------------
Locked ownable synchronizers:
    - None
----------------- 5651 -----------------
Locked ownable synchronizers:
    - None
----------------- 5652 -----------------
----------------- 5629 -----------------
0x00007efd819278ad	__pthread_join + 0xbd

$ jps
5994 Jps
5515 org.eclipse.equinox.launcher_1.4.0.v20171217-1438.jar
5629 HelloWait

$ cat HelloWait.java

public class HelloWait {

    public static void main(String[] args) {
        System.out.println("Hello World");
        try {
            while (true) {
                Thread.sleep(200);
            }
        } catch (InterruptedException e) {
            // ignore
        }
    }

}

If I remove java-1.8.0-openjdk-headless-debuginfo, but keep java-1.8.0-openjdk-debuginfo I get the same error as you. Thoughts?

Comment 2 Attila Fazekas 2018-04-25 10:04:53 UTC
Looks like I missed the 2th debuginfo package.
Thank you.