Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 8c1112a

Browse files
author
David Holmes
committedMar 15, 2021
8261916: gtest/GTestWrapper.java vmErrorTest.unimplemented1_vm_assert failed
Reviewed-by: dcubed, coleenp
1 parent 1e57087 commit 8c1112a

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed
 

‎src/hotspot/os/posix/os_posix.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1878,13 +1878,17 @@ void os::shutdown() {
18781878
// Note: os::abort() might be called very early during initialization, or
18791879
// called from signal handler. Before adding something to os::abort(), make
18801880
// sure it is async-safe and can handle partially initialized VM.
1881+
// Also note we can abort while other threads continue to run, so we can
1882+
// easily trigger secondary faults in those threads. To reduce the likelihood
1883+
// of that we use _exit rather than exit, so that no atexit hooks get run.
1884+
// But note that os::shutdown() could also trigger secondary faults.
18811885
void os::abort(bool dump_core, void* siginfo, const void* context) {
18821886
os::shutdown();
18831887
if (dump_core) {
18841888
LINUX_ONLY(if (DumpPrivateMappingsInCore) ClassLoader::close_jrt_image();)
18851889
::abort(); // dump core
18861890
}
1887-
::exit(1);
1891+
::_exit(1);
18881892
}
18891893

18901894
// Die immediately, no exit hook, no abort hook, no cleanup.

‎src/hotspot/share/utilities/vmError.cpp

+23-10
Original file line numberDiff line numberDiff line change
@@ -1372,13 +1372,14 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
13721372
static bool out_done = false; // done printing to standard out
13731373
static bool log_done = false; // done saving error log
13741374

1375-
if (SuppressFatalErrorMessage) {
1376-
os::abort(CreateCoredumpOnCrash);
1377-
}
13781375
intptr_t mytid = os::current_thread_id();
13791376
if (_first_error_tid == -1 &&
13801377
Atomic::cmpxchg(&_first_error_tid, (intptr_t)-1, mytid) == -1) {
13811378

1379+
if (SuppressFatalErrorMessage) {
1380+
os::abort(CreateCoredumpOnCrash);
1381+
}
1382+
13821383
// Initialize time stamps to use the same base.
13831384
out.time_stamp().update_to(1);
13841385
log.time_stamp().update_to(1);
@@ -1428,21 +1429,33 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
14281429
// This is not the first error, see if it happened in a different thread
14291430
// or in the same thread during error reporting.
14301431
if (_first_error_tid != mytid) {
1431-
char msgbuf[64];
1432-
jio_snprintf(msgbuf, sizeof(msgbuf),
1433-
"[thread " INTX_FORMAT " also had an error]",
1434-
mytid);
1435-
out.print_raw_cr(msgbuf);
1432+
if (!SuppressFatalErrorMessage) {
1433+
char msgbuf[64];
1434+
jio_snprintf(msgbuf, sizeof(msgbuf),
1435+
"[thread " INTX_FORMAT " also had an error]",
1436+
mytid);
1437+
out.print_raw_cr(msgbuf);
1438+
}
14361439

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

14401444
} else {
14411445
if (recursive_error_count++ > 30) {
1442-
out.print_raw_cr("[Too many errors, abort]");
1446+
if (!SuppressFatalErrorMessage) {
1447+
out.print_raw_cr("[Too many errors, abort]");
1448+
}
14431449
os::die();
14441450
}
14451451

1452+
if (SuppressFatalErrorMessage) {
1453+
// If we already hit a secondary error during abort, then calling
1454+
// it again is likely to hit another one. But eventually, if we
1455+
// don't deadlock somewhere, we will call os::die() above.
1456+
os::abort(CreateCoredumpOnCrash);
1457+
}
1458+
14461459
outputStream* const st = log.is_open() ? &log : &out;
14471460
st->cr();
14481461

0 commit comments

Comments
 (0)
This repository has been archived.