< prev index next >

src/hotspot/share/utilities/vmError.cpp

Print this page




1387 
1388     reporting_started();
1389     if (!TestUnresponsiveErrorHandler) {
1390       // Record reporting_start_time unless we're running the
1391       // TestUnresponsiveErrorHandler test. For that test we record
1392       // reporting_start_time at the beginning of the test.
1393       record_reporting_start_time();
1394     } else {
1395       out.print_raw_cr("Delaying recording reporting_start_time for TestUnresponsiveErrorHandler.");
1396     }
1397 
1398     if (ShowMessageBoxOnError || PauseAtExit) {
1399       show_message_box(buffer, sizeof(buffer));
1400 
1401       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
1402       // WatcherThread can kill JVM if the error handler hangs.
1403       ShowMessageBoxOnError = false;
1404     }
1405 
1406     os::check_dump_limit(buffer, sizeof(buffer));

1407 
1408     // reset signal handlers or exception filter; make sure recursive crashes
1409     // are handled properly.
1410     reset_signal_handlers();
1411 
1412     EventShutdown e;
1413     if (e.should_commit()) {
1414       e.set_reason("VM Error");
1415       e.commit();
1416     }
1417 
1418     JFR_ONLY(Jfr::on_vm_shutdown(true);)
1419 
1420   } else {
1421     // If UseOsErrorReporting we call this for each level of the call stack
1422     // while searching for the exception handler.  Only the first level needs
1423     // to be reported.
1424     if (UseOSErrorReporting && log_done) return;
1425 
1426     // This is not the first error, see if it happened in a different thread
1427     // or in the same thread during error reporting.
1428     if (_first_error_tid != mytid) {
1429       char msgbuf[64];
1430       jio_snprintf(msgbuf, sizeof(msgbuf),
1431                    "[thread " INTX_FORMAT " also had an error]",
1432                    mytid);
1433       out.print_raw_cr(msgbuf);
1434 
1435       // error reporting is not MT-safe, block current thread
1436       os::infinite_sleep();
1437 
1438     } else {
1439       if (recursive_error_count++ > 30) {


1520         } else {
1521           out.print_raw_cr("# Can not save log file, dump to screen..");
1522           fd_log = 1;
1523         }
1524       }
1525       log.set_fd(fd_log);
1526     }
1527 
1528     report(&log, true);
1529     log_done = true;
1530     _current_step = 0;
1531     _current_step_info = "";
1532 
1533     if (fd_log > 3) {
1534       close(fd_log);
1535       fd_log = -1;
1536     }
1537 
1538     log.set_fd(-1);
1539   }


1540 
1541   if (PrintNMTStatistics) {
1542     fdStream fds(fd_out);
1543     MemTracker::final_report(&fds);
1544   }
1545 
1546   static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1547   if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1548     skip_replay = true;
1549     ciEnv* env = ciEnv::current();
1550     if (env != NULL) {
1551       const bool overwrite = false; // We do not overwrite an existing replay file.
1552       int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1553       if (fd != -1) {
1554         FILE* replay_data_file = os::open(fd, "w");
1555         if (replay_data_file != NULL) {
1556           fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1557           env->dump_replay_data_unsafe(&replay_data_stream);
1558           out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1559           out.print_raw_cr(buffer);




1387 
1388     reporting_started();
1389     if (!TestUnresponsiveErrorHandler) {
1390       // Record reporting_start_time unless we're running the
1391       // TestUnresponsiveErrorHandler test. For that test we record
1392       // reporting_start_time at the beginning of the test.
1393       record_reporting_start_time();
1394     } else {
1395       out.print_raw_cr("Delaying recording reporting_start_time for TestUnresponsiveErrorHandler.");
1396     }
1397 
1398     if (ShowMessageBoxOnError || PauseAtExit) {
1399       show_message_box(buffer, sizeof(buffer));
1400 
1401       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
1402       // WatcherThread can kill JVM if the error handler hangs.
1403       ShowMessageBoxOnError = false;
1404     }
1405 
1406     os::check_dump_limit(buffer, sizeof(buffer));
1407     JFR_ONLY(Jfr::setup_emergency_dump_file_descriptor();)
1408 
1409     // reset signal handlers or exception filter; make sure recursive crashes
1410     // are handled properly.
1411     reset_signal_handlers();
1412 
1413     EventShutdown e;
1414     if (e.should_commit()) {
1415       e.set_reason("VM Error");
1416       e.commit();
1417     }
1418 


1419   } else {
1420     // If UseOsErrorReporting we call this for each level of the call stack
1421     // while searching for the exception handler.  Only the first level needs
1422     // to be reported.
1423     if (UseOSErrorReporting && log_done) return;
1424 
1425     // This is not the first error, see if it happened in a different thread
1426     // or in the same thread during error reporting.
1427     if (_first_error_tid != mytid) {
1428       char msgbuf[64];
1429       jio_snprintf(msgbuf, sizeof(msgbuf),
1430                    "[thread " INTX_FORMAT " also had an error]",
1431                    mytid);
1432       out.print_raw_cr(msgbuf);
1433 
1434       // error reporting is not MT-safe, block current thread
1435       os::infinite_sleep();
1436 
1437     } else {
1438       if (recursive_error_count++ > 30) {


1519         } else {
1520           out.print_raw_cr("# Can not save log file, dump to screen..");
1521           fd_log = 1;
1522         }
1523       }
1524       log.set_fd(fd_log);
1525     }
1526 
1527     report(&log, true);
1528     log_done = true;
1529     _current_step = 0;
1530     _current_step_info = "";
1531 
1532     if (fd_log > 3) {
1533       close(fd_log);
1534       fd_log = -1;
1535     }
1536 
1537     log.set_fd(-1);
1538   }
1539 
1540   JFR_ONLY(Jfr::on_vm_shutdown(true);)
1541 
1542   if (PrintNMTStatistics) {
1543     fdStream fds(fd_out);
1544     MemTracker::final_report(&fds);
1545   }
1546 
1547   static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1548   if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1549     skip_replay = true;
1550     ciEnv* env = ciEnv::current();
1551     if (env != NULL) {
1552       const bool overwrite = false; // We do not overwrite an existing replay file.
1553       int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1554       if (fd != -1) {
1555         FILE* replay_data_file = os::open(fd, "w");
1556         if (replay_data_file != NULL) {
1557           fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1558           env->dump_replay_data_unsafe(&replay_data_stream);
1559           out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1560           out.print_raw_cr(buffer);


< prev index next >