8146011: sun/management/jmxremote/bootstrap/CustomLauncherTest crash at assert(stack_size)
authorcoleenp
Wed, 23 Dec 2015 20:07:39 +0000
changeset 35222 fc89375d788d
parent 35217 ce4b5303a813
child 35223 a68498ab5403
8146011: sun/management/jmxremote/bootstrap/CustomLauncherTest crash at assert(stack_size) Summary: We were setting stack_overflow_limit before initialization completed which may change the stack base for some solaris systems with unlimited stack Reviewed-by: goetz, hseigel, gthornbr
hotspot/src/share/vm/runtime/thread.cpp
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Dec 23 13:12:15 2015 +0300
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Dec 23 20:07:39 2015 +0000
@@ -306,10 +306,6 @@
 void Thread::record_stack_base_and_size() {
   set_stack_base(os::current_stack_base());
   set_stack_size(os::current_stack_size());
-  if (is_Java_thread()) {
-    ((JavaThread*) this)->set_stack_overflow_limit();
-    ((JavaThread*) this)->set_reserved_stack_activation(stack_base());
-  }
   // CR 7190089: on Solaris, primordial thread's stack is adjusted
   // in initialize_thread(). Without the adjustment, stack size is
   // incorrect if stack is set to unlimited (ulimit -s unlimited).
@@ -318,6 +314,11 @@
   // set up any platform-specific state.
   os::initialize_thread(this);
 
+  // Set stack limits after thread is initialized.
+  if (is_Java_thread()) {
+    ((JavaThread*) this)->set_stack_overflow_limit();
+    ((JavaThread*) this)->set_reserved_stack_activation(stack_base());
+  }
 #if INCLUDE_NMT
   // record thread's native stack, stack grows downward
   MemTracker::record_thread_stack(stack_end(), stack_size());