Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8261916: gtest/GTestWrapper.java vmErrorTest.unimplemented1_vm_assert…
… failed

Reviewed-by: clanger
Backport-of: 8c1112a
  • Loading branch information
tstuefe committed Nov 15, 2021
1 parent 6ec651f commit 46d8523
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/os/aix/os_aix.cpp
Expand Up @@ -1188,7 +1188,7 @@ void os::abort(bool dump_core, void* siginfo, const void* context) {
::abort(); // dump core
}

::exit(1);
::_exit(1);
}

// Die immediately, no exit hook, no abort hook, no cleanup.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/bsd/os_bsd.cpp
Expand Up @@ -1092,7 +1092,7 @@ void os::abort(bool dump_core, void* siginfo, const void* context) {
::abort(); // dump core
}

::exit(1);
::_exit(1);
}

// Die immediately, no exit hook, no abort hook, no cleanup.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/linux/os_linux.cpp
Expand Up @@ -1512,7 +1512,7 @@ void os::abort(bool dump_core, void* siginfo, const void* context) {
::abort(); // dump core
}

::exit(1);
::_exit(1);
}

// Die immediately, no exit hook, no abort hook, no cleanup.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/solaris/os_solaris.cpp
Expand Up @@ -1343,7 +1343,7 @@ void os::abort(bool dump_core, void* siginfo, const void* context) {
::abort(); // dump core (for debugging)
}

::exit(1);
::_exit(1);
}

// Die immediately, no exit hook, no abort hook, no cleanup.
Expand Down
33 changes: 23 additions & 10 deletions src/hotspot/share/utilities/vmError.cpp
Expand Up @@ -1341,13 +1341,14 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
static bool log_done = false; // done saving error log
static bool transmit_report_done = false; // done error reporting

if (SuppressFatalErrorMessage) {
os::abort(CreateCoredumpOnCrash);
}
intptr_t mytid = os::current_thread_id();
if (first_error_tid == -1 &&
Atomic::cmpxchg(mytid, &first_error_tid, (intptr_t)-1) == -1) {

if (SuppressFatalErrorMessage) {
os::abort(CreateCoredumpOnCrash);
}

// Initialize time stamps to use the same base.
out.time_stamp().update_to(1);
log.time_stamp().update_to(1);
Expand Down Expand Up @@ -1400,21 +1401,33 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
// This is not the first error, see if it happened in a different thread
// or in the same thread during error reporting.
if (first_error_tid != mytid) {
char msgbuf[64];
jio_snprintf(msgbuf, sizeof(msgbuf),
"[thread " INTX_FORMAT " also had an error]",
mytid);
out.print_raw_cr(msgbuf);
if (!SuppressFatalErrorMessage) {
char msgbuf[64];
jio_snprintf(msgbuf, sizeof(msgbuf),
"[thread " INTX_FORMAT " also had an error]",
mytid);
out.print_raw_cr(msgbuf);
}

// error reporting is not MT-safe, block current thread
// Error reporting is not MT-safe, nor can we let the current thread
// proceed, so we block it.
os::infinite_sleep();

} else {
if (recursive_error_count++ > 30) {
out.print_raw_cr("[Too many errors, abort]");
if (!SuppressFatalErrorMessage) {
out.print_raw_cr("[Too many errors, abort]");
}
os::die();
}

if (SuppressFatalErrorMessage) {
// If we already hit a secondary error during abort, then calling
// it again is likely to hit another one. But eventually, if we
// don't deadlock somewhere, we will call os::die() above.
os::abort(CreateCoredumpOnCrash);
}

outputStream* const st = log.is_open() ? &log : &out;
st->cr();

Expand Down

1 comment on commit 46d8523

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.