-
Bug
-
Resolution: Fixed
-
P4
-
21, 22, 23, 24
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8338683 | 23.0.2 | Paul Hohensee | P4 | Resolved | Fixed | b01 |
JDK-8338913 | 21.0.5 | Paul Hohensee | P4 | Resolved | Fixed | b05 |
How to reproduce:
1. Start a Java process that has a thread which will be WAITING status due to calling Object.wait().
```
Object lock = new Object();
Thread t = new Thread(() -> {
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException ie) {}
}
}, "WaitThread");
t.start();
```
2. Use jhsdb to attach to the process and print stack and locks information.
> jhsdb jstack --pid <PID>
3. There is a difference in the lock information by jdk21 or later and by jdk17. In jdk21 and later, the line "waiting on ..." indicating the lock information of the waiting thread is not printed.
- in jdk24
"WaitThread" #19 prio=5 tid=0x0000029087102ae0 nid=691792 in Object.wait() [0x000000e228aff000]
java.lang.Thread.State: WAITING (on object monitor)
JavaThread state: _thread_blocked
- java.lang.Object.wait0(long) @bci=0 (Interpreted frame)
- java.lang.Object.wait(long) @bci=11, line=374 (Interpreted frame)
- java.lang.Object.wait() @bci=2, line=348 (Interpreted frame)
- WaitTest.lambda$main$0(java.lang.Object) @bci=5, line=37 (Interpreted frame)
- locked <0x0000000087ff8c38> (a java.lang.Object)
- WaitTest$$Lambda+0x0000029043000a10.run() @bci=4 (Interpreted frame)
- java.lang.Thread.runWith(java.lang.Object, java.lang.Runnable) @bci=5, line=1588 (Interpreted frame)
- java.lang.Thread.run() @bci=19, line=1575 (Interpreted frame)
- in jdk17
"WaitThread" #13 prio=5 tid=0x00000183b1369ea0 nid=0xabec8 in Object.wait() [0x0000007943aff000]
java.lang.Thread.State: WAITING (on object monitor)
JavaThread state: _thread_blocked
- java.lang.Object.wait(long) @bci=0 (Interpreted frame)
- waiting on <0x0000000087ff0388> (a java.lang.Object)
- java.lang.Object.wait() @bci=2, line=338 (Interpreted frame)
- WaitTest.lambda$main$0(java.lang.Object) @bci=5, line=37 (Interpreted frame)
- locked <0x0000000087ff0388> (a java.lang.Object)
- WaitTest$$Lambda$1+0x00000183b3000a00.run() @bci=4 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=840 (Interpreted frame)
This problem also occurs when you start the interactive command-line debugger with "jhsdb clhsdb" and print a thread dump with the "jstack" or "where" command. On the other hand, when using "jstack" or "jcmd Thread.print", the lock information will be printed correctly.
- backported by
-
JDK-8338683 jhsdb jstack cannot print some information on the waiting thread
- Resolved
-
JDK-8338913 jhsdb jstack cannot print some information on the waiting thread
- Resolved
- relates to
-
JDK-8336284 Test TestClhsdbJstackLock.java/TestJhsdbJstackLock.java fails with -Xcomp after JDK-8335743
- Resolved
-
JDK-8336322 TestJhsdbJstackLock.java and TestJhsdbJstackLock.java failed after JDK-8335743
- Closed
- links to
-
Commit(master) openjdk/jdk21u-dev/b8038eac
-
Commit(master) openjdk/jdk23u/a4dcbb3b
-
Commit(master) openjdk/jdk/d6c6847e
-
Review(master) openjdk/jdk21u-dev/853
-
Review(master) openjdk/jdk23u/59
-
Review(master) openjdk/jdk/20049