From c0ea5af3a9127cb84660543c84a22f04df8ada19 Mon Sep 17 00:00:00 2001 From: dholmes Date: Mon, 18 Nov 2019 23:41:06 -0500 Subject: [PATCH] 8215355: Object monitor deadlock with no threads holding the monitor (using jemalloc 5.1) Reviewed-by: rehn, stuefe, dcubed, sspitsyn --- .../src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java | 4 ++-- src/share/vm/runtime/thread.cpp | 2 +- src/share/vm/runtime/thread.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java b/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java index fa5844097..7e5dbb707 100644 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/JavaThread.java @@ -371,14 +371,14 @@ public class JavaThread extends Thread { Address stackBase = getStackBase(); // Be robust if (sp == null) return false; - return stackBase.greaterThanOrEqual(a) && sp.lessThanOrEqual(a); + return stackBase.greaterThan(a) && sp.lessThanOrEqual(a); } public boolean isLockOwned(Address a) { Address stackBase = getStackBase(); Address stackLimit = stackBase.addOffsetTo(-getStackSize()); - return stackBase.greaterThanOrEqual(a) && stackLimit.lessThanOrEqual(a); + return stackBase.greaterThan(a) && stackLimit.lessThanOrEqual(a); // FIXME: should traverse MonitorArray/MonitorChunks as in VM } diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 7d04bef08..330593acb 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -962,7 +962,7 @@ bool Thread::is_in_stack(address adr) const { address end = os::current_stack_pointer(); // Allow non Java threads to call this without stack_base if (_stack_base == NULL) return true; - if (stack_base() >= adr && adr >= end) return true; + if (stack_base() > adr && adr >= end) return true; return false; } diff --git a/src/share/vm/runtime/thread.hpp b/src/share/vm/runtime/thread.hpp index 3298aeec8..d3a614577 100644 --- a/src/share/vm/runtime/thread.hpp +++ b/src/share/vm/runtime/thread.hpp @@ -558,7 +558,7 @@ protected: bool on_local_stack(address adr) const { /* QQQ this has knowledge of direction, ought to be a stack method */ - return (_stack_base >= adr && adr >= (_stack_base - _stack_size)); + return (_stack_base > adr && adr >= (_stack_base - _stack_size)); } uintptr_t self_raw_id() { return _self_raw_id; } -- GitLab