@@ -1372,13 +1372,14 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
1372
1372
static bool out_done = false ; // done printing to standard out
1373
1373
static bool log_done = false ; // done saving error log
1374
1374
1375
- if (SuppressFatalErrorMessage) {
1376
- os::abort (CreateCoredumpOnCrash);
1377
- }
1378
1375
intptr_t mytid = os::current_thread_id ();
1379
1376
if (_first_error_tid == -1 &&
1380
1377
Atomic::cmpxchg (&_first_error_tid, (intptr_t )-1 , mytid) == -1 ) {
1381
1378
1379
+ if (SuppressFatalErrorMessage) {
1380
+ os::abort (CreateCoredumpOnCrash);
1381
+ }
1382
+
1382
1383
// Initialize time stamps to use the same base.
1383
1384
out.time_stamp ().update_to (1 );
1384
1385
log .time_stamp ().update_to (1 );
@@ -1428,21 +1429,33 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
1428
1429
// This is not the first error, see if it happened in a different thread
1429
1430
// or in the same thread during error reporting.
1430
1431
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
+ }
1436
1439
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.
1438
1442
os::infinite_sleep ();
1439
1443
1440
1444
} else {
1441
1445
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
+ }
1443
1449
os::die ();
1444
1450
}
1445
1451
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
+
1446
1459
outputStream* const st = log .is_open () ? &log : &out;
1447
1460
st->cr ();
1448
1461
0 commit comments