mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
8036823: Stack trace sometimes shows 'locked' instead of 'waiting to lock'
Add a !owner check for 'waiting to lock' to catch current_pending_monitor corner cases. Co-authored-by: Krystal Mok <rednaxelafx@gmail.com> Co-authored-by: Zhengyu Gu <zhengyu.gu@oracle.com> Reviewed-by: dholmes, sspitsyn, kmo, zgu
This commit is contained in:
parent
5ff7186a1c
commit
ad6d8d6abd
4 changed files with 421 additions and 1 deletions
|
@ -385,6 +385,15 @@ void ATTR ObjectMonitor::enter(TRAPS) {
|
|||
jt->java_suspend_self();
|
||||
}
|
||||
Self->set_current_pending_monitor(NULL);
|
||||
|
||||
// We cleared the pending monitor info since we've just gotten past
|
||||
// the enter-check-for-suspend dance and we now own the monitor free
|
||||
// and clear, i.e., it is no longer pending. The ThreadBlockInVM
|
||||
// destructor can go to a safepoint at the end of this block. If we
|
||||
// do a thread dump during that safepoint, then this thread will show
|
||||
// as having "-locked" the monitor, but the OS and java.lang.Thread
|
||||
// states will still report that the thread is blocked trying to
|
||||
// acquire it.
|
||||
}
|
||||
|
||||
Atomic::dec_ptr(&_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue