Merge
This commit is contained in:
commit
7d4135b630
@ -1067,8 +1067,15 @@ void ThreadsSMRSupport::print_info_on(const Thread* thread, outputStream* st) {
|
||||
|
||||
// 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:");
|
||||
|
@ -1698,6 +1698,13 @@ void VMError::controlled_crash(int how) {
|
||||
// Case 15 is tested by test/hotspot/jtreg/runtime/ErrorHandling/SecondaryErrorTest.java.
|
||||
// Case 16 is tested by test/hotspot/jtreg/runtime/ErrorHandling/ThreadsListHandleInErrorHandlingTest.java.
|
||||
// Case 17 is tested by test/hotspot/jtreg/runtime/ErrorHandling/NestedThreadsListHandleInErrorHandlingTest.java.
|
||||
|
||||
// We grab Threads_lock to keep ThreadsSMRSupport::print_info_on()
|
||||
// from racing with Threads::add() or Threads::remove() as we
|
||||
// generate the hs_err_pid file. This makes our ErrorHandling tests
|
||||
// more stable.
|
||||
MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
switch (how) {
|
||||
case 1: vmassert(str == NULL, "expected null"); break;
|
||||
case 2: vmassert(num == 1023 && *str == 'X',
|
||||
|
Loading…
Reference in New Issue
Block a user