8212207: runtime/InternalApi/ThreadCpuTimesDeadlock.java crashes with SEGV in pthread_getcpuclockid+0x0
authordholmes
Tue, 27 Nov 2018 22:02:52 -0500
changeset 52707 4b427f2653f1
parent 52706 19b15ff2576b
child 52708 1ffff60c9f54
8212207: runtime/InternalApi/ThreadCpuTimesDeadlock.java crashes with SEGV in pthread_getcpuclockid+0x0 Summary: skip non-JavaThreads that have not reached a minimal initialization point - setting their stack size Reviewed-by: kbarrett, stuefe
src/hotspot/share/services/management.cpp
--- a/src/hotspot/share/services/management.cpp	Tue Nov 27 21:20:16 2018 -0500
+++ b/src/hotspot/share/services/management.cpp	Tue Nov 27 22:02:52 2018 -0500
@@ -1645,6 +1645,12 @@
     return;
   }
 
+  // NonJavaThread instances may not be fully initialized yet, so we need to
+  // skip any that aren't - check for zero stack_size()
+  if (!thread->is_Java_thread() && thread->stack_size() == 0) {
+    return;
+  }
+
   if (_count >= _names_len || _count >= _times_len) {
     // skip if the result array is not big enough
     return;