src/hotspot/share/runtime/threadSMR.cpp
changeset 50718 5698cf4e50f1
parent 49956 a87f2e7a527c
child 52341 2b58b8e1d28f
--- a/src/hotspot/share/runtime/threadSMR.cpp	Fri Jun 22 18:49:45 2018 +0300
+++ b/src/hotspot/share/runtime/threadSMR.cpp	Fri Jun 22 12:15:16 2018 -0400
@@ -1067,8 +1067,15 @@
 
 // Print Threads class SMR info.
 void ThreadsSMRSupport::print_info_on(outputStream* st) {
-  // Only grab the Threads_lock if we don't already own it
-  // and if we are not reporting an error.
+  // Only grab the Threads_lock if we don't already own it and if we
+  // are not reporting an error.
+  // Note: Not grabbing the Threads_lock during error reporting is
+  // dangerous because the data structures we want to print can be
+  // freed concurrently. However, grabbing the Threads_lock during
+  // error reporting can be equally dangerous since this thread might
+  // block during error reporting or a nested error could leave the
+  // Threads_lock held. The classic no win scenario.
+  //
   MutexLockerEx ml((Threads_lock->owned_by_self() || VMError::is_error_reported()) ? NULL : Threads_lock);
 
   st->print_cr("Threads class SMR info:");