8215355: Object monitor deadlock with no threads holding the monitor (using jemalloc 5.1)
authordholmes
Mon, 18 Nov 2019 23:41:06 -0500
changeset 59132 189f47d990b5
parent 59131 6645186a5a31
child 59133 580fb715b29d
8215355: Object monitor deadlock with no threads holding the monitor (using jemalloc 5.1) Reviewed-by: rehn, stuefe, dcubed, sspitsyn
src/hotspot/share/runtime/thread.cpp
src/hotspot/share/runtime/thread.hpp
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java
--- a/src/hotspot/share/runtime/thread.cpp	Tue Nov 19 13:33:09 2019 +0900
+++ b/src/hotspot/share/runtime/thread.cpp	Mon Nov 18 23:41:06 2019 -0500
@@ -1007,7 +1007,7 @@
   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;
 }
--- a/src/hotspot/share/runtime/thread.hpp	Tue Nov 19 13:33:09 2019 +0900
+++ b/src/hotspot/share/runtime/thread.hpp	Mon Nov 18 23:41:06 2019 -0500
@@ -729,7 +729,7 @@
 
   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_end());
+    return (_stack_base > adr && adr >= stack_end());
   }
 
   int     lgrp_id() const        { return _lgrp_id; }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java	Tue Nov 19 13:33:09 2019 +0900
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java	Mon Nov 18 23:41:06 2019 -0500
@@ -384,14 +384,14 @@
     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
   }