8027429.01 Sdiff src/share/vm/utilities (original) (raw)


208 st->print_cr("# Possible solutions:"); 209 st->print_cr("# Reduce memory load on the system"); 210 st->print_cr("# Increase physical memory or swap space"); 211 st->print_cr("# Check if swap backing store is full"); 212 st->print_cr("# Use 64 bit Java on a 64 bit OS"); 213 st->print_cr("# Decrease Java heap size (-Xmx/-Xms)"); 214 st->print_cr("# Decrease number of Java threads"); 215 st->print_cr("# Decrease Java thread stack sizes (-Xss)"); 216 st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize="); 217 st->print_cr("# This output file may be truncated or incomplete."); 218 } 219 220 const char* VMError::gc_mode() { 221 if (UseG1GC) return "g1 gc"; 222 if (UseParallelGC) return "parallel gc"; 223 if (UseConcMarkSweepGC) return "concurrent mark sweep gc"; 224 if (UseSerialGC) return "serial gc"; 225 return "ERROR in GC mode"; 226 } 227

228 // This is the main function to report a fatal error. Only one thread can 229 // call this function, so we don't need to worry about MT-safety. But it's 230 // possible that the error handler itself may crash or die on an internal 231 // error, for example, when the stack/heap is badly damaged. We must be 232 // able to handle recursive errors that happen inside error handler. 233 // 234 // Error reporting is done in several steps. If a crash or internal error 235 // occurred when reporting an error, the nested signal/exception handler 236 // can skip steps that are already (or partially) done. Error reporting will 237 // continue from the next step. This allows us to retrieve and print 238 // information that may be unsafe to get after a fatal error. If it happens, 239 // you may find nested report_and_die() frames when you look at the stack 240 // in a debugger. 241 // 242 // In general, a hang in error handler is much worse than a crash or internal 243 // error, as it's harder to recover from a hang. Deadlock can happen if we 244 // try to grab a lock that is already owned by current thread, or if the 245 // owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the 246 // error handler and all the functions it called should avoid grabbing any 247 // lock. An important thing to notice is that memory allocation needs a lock. 248 // 249 // We should avoid using large stack allocated buffers. Many errors happen 250 // when stack space is already low. Making things even worse is that there 251 // could be nested report_and_die() calls on stack (see above). Only one 252 // thread can report error, so large buffers are statically allocated in data 253 // segment. 254 255 int VMError::_current_step; 256 const char* VMError::_current_step_info;

257 258 void VMError::report(outputStream* st, bool _verbose) { 259 260 # define BEGIN if (_current_step == 0) { _current_step = 1; 261 # define STEP(n, s) } if (_current_step < n) { _current_step = n; _current_step_info = s; 262 # define END } 263 264 // don't allocate large buffer on stack 265 static char buf[O_BUFLEN];

266 267 BEGIN

268 269 STEP(10, "(printing fatal error message)")

270 271 st->print_cr("#"); 272 if (should_report_bug(_id)) { 273 st->print_cr("# A fatal error has been detected by the Java Runtime Environment:");

274 } else { 275 st->print_cr("# There is insufficient memory for the Java " 276 "Runtime Environment to continue."); 277 }

278 279 #ifndef PRODUCT 280 // Error handler self tests

281

282 // test secondary error handling. Test it twice, to test that resetting 283 // error handler after a secondary crash works. 284 STEP(20, "(test secondary crash 1)") 285 if (_verbose && TestCrashInErrorHandler != 0) { 286 st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", 287 TestCrashInErrorHandler); 288 controlled_crash(TestCrashInErrorHandler); 289 } 290 291 STEP(30, "(test secondary crash 2)") 292 if (_verbose && TestCrashInErrorHandler != 0) { 293 st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", 294 TestCrashInErrorHandler); 295 controlled_crash(TestCrashInErrorHandler); 296 } 297 298 STEP(40, "(test safefetch in error handler)") 299 // test whether it is safe to use SafeFetch32 in Crash Handler. Test twice 300 // to test that resetting the signal handler works correctly. 301 if (_verbose && TestSafeFetchInErrorHandler) { 302 st->print_cr("Will test SafeFetch..."); 303 if (CanUseSafeFetch32()) { 304 int* const invalid_pointer = (int*) get_segfault_address(); 305 const int x = 0x76543210; 306 int i1 = SafeFetch32(invalid_pointer, x); 307 int i2 = SafeFetch32(invalid_pointer, x); 308 if (i1 == x && i2 == x) { 309 st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern 310 } else { 311 st->print_cr("??"); 312 } 313 } else { 314 st->print_cr("not possible; skipped."); 315 } 316 }

317 #endif // PRODUCT 318 319 STEP(50, "(printing type of error)") 320 321 switch(_id) { 322 case OOM_MALLOC_ERROR: 323 case OOM_MMAP_ERROR: 324 if (_size) { 325 st->print("# Native memory allocation "); 326 st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : 327 "(mmap) failed to map "); 328 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); 329 st->print("%s", buf); 330 st->print(" bytes"); 331 if (strlen(_detail_msg) > 0) { 332 st->print(" for "); 333 st->print("%s", _detail_msg); 334 } 335 st->cr(); 336 } else { 337 if (strlen(_detail_msg) > 0) { 338 st->print("# "); 339 st->print_cr("%s", _detail_msg); 340 } 341 } 342 // In error file give some solutions 343 if (_verbose) { 344 print_oom_reasons(st); 345 } else { 346 return; // that's enough for the screen 347 } 348 break;

349 case INTERNAL_ERROR: 350 default: 351 break; 352 } 353 354 STEP(60, "(printing exception/signal name)") 355 356 st->print_cr("#"); 357 st->print("# "); 358 // Is it an OS exception/signal? 359 if (os::exception_name(_id, buf, sizeof(buf))) { 360 st->print("%s", buf); 361 st->print(" (0x%x)", _id); // signal number 362 st->print(" at pc=" PTR_FORMAT, p2i(_pc)); 363 } else { 364 if (should_report_bug(_id)) { 365 st->print("Internal Error"); 366 } else { 367 st->print("Out of Memory Error"); 368 }


385 386 // process id, thread id 387 st->print(", pid=%d", os::current_process_id()); 388 st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); 389 st->cr(); 390 391 STEP(80, "(printing error message)") 392 393 if (should_report_bug(_id)) { // already printed the message. 394 // error message 395 if (strlen(_detail_msg) > 0) { 396 st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); 397 } else if (_message) { 398 st->print_cr("# Error: %s", _message); 399 } 400 } 401 402 STEP(90, "(printing Java version string)") 403 404 // VM version 405 st->print_cr("#"); 406 JDK_Version::current().to_string(buf, sizeof(buf)); 407 const char* runtime_name = JDK_Version::runtime_name() != NULL ? 408 JDK_Version::runtime_name() : ""; 409 const char* runtime_version = JDK_Version::runtime_version() != NULL ? 410 JDK_Version::runtime_version() : ""; 411 st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version); 412 // This is the long version with some default settings added 413 st->print_cr("# Java VM: %s (%s, %s%s%s%s%s, %s, %s)", 414 Abstract_VM_Version::vm_name(), 415 Abstract_VM_Version::vm_release(), 416 Abstract_VM_Version::vm_info_string(), 417 TieredCompilation ? ", tiered" : "", 418 #if INCLUDE_JVMCI 419 EnableJVMCI ? ", jvmci" : "", 420 UseJVMCICompiler ? ", jvmci compiler" : "", 421 #else 422 "", "", 423 #endif 424 UseCompressedOops ? ", compressed oops" : "", 425 gc_mode(), 426 Abstract_VM_Version::vm_platform_string() 427 ); 428 429 STEP(100, "(printing problematic frame)") 430 431 // Print current frame if we have a context (i.e. it's a crash) 432 if (_context) { 433 st->print_cr("# Problematic frame:"); 434 st->print("# "); 435 frame fr = os::fetch_frame_from_context(_context); 436 fr.print_on_error(st, buf, sizeof(buf)); 437 st->cr(); 438 st->print_cr("#"); 439 } 440 441 STEP(110, "(printing core file information)") 442 st->print("# "); 443 if (CreateCoredumpOnCrash) { 444 if (coredump_status) { 445 st->print("Core dump will be written. Default location: %s", coredump_message); 446 } else { 447 st->print("No core dump will be written. %s", coredump_message); 448 } 449 } else { 450 st->print("CreateCoredumpOnCrash turned off, no core file dumped"); 451 } 452 st->cr(); 453 st->print_cr("#"); 454 455 STEP(120, "(printing bug submit message)") 456 457 if (should_report_bug(_id) && _verbose) { 458 print_bug_submit_message(st, _thread); 459 } 460 461 STEP(130, "(printing summary)" ) 462 463 if (_verbose) { 464 st->cr(); 465 st->print_cr("--------------- S U M M A R Y ------------"); 466 st->cr(); 467 } 468 469 STEP(140, "(printing VM option summary)" ) 470 471 if (_verbose) { 472 // VM options 473 Arguments::print_summary_on(st); 474 st->cr(); 475 } 476 477 STEP(150, "(printing summary machine and OS info)") 478 479 if (_verbose) { 480 os::print_summary_info(st, buf, sizeof(buf)); 481 } 482 483 484 STEP(160, "(printing date and time)" ) 485

486 if (_verbose) { 487 os::print_date_and_time(st, buf, sizeof(buf)); 488 } 489 490 STEP(170, "(printing thread)" ) 491 492 if (_verbose) { 493 st->cr(); 494 st->print_cr("--------------- T H R E A D ---------------"); 495 st->cr(); 496 } 497 498 STEP(180, "(printing current thread)" ) 499 500 // current thread 501 if (_verbose) { 502 if (_thread) { 503 st->print("Current thread (" PTR_FORMAT "): ", p2i(_thread)); 504 _thread->print_on_error(st, buf, sizeof(buf)); 505 st->cr(); 506 } else { 507 st->print_cr("Current thread is native thread"); 508 } 509 st->cr(); 510 } 511 512 STEP(190, "(printing current compile task)" ) 513 514 if (_verbose && _thread && _thread->is_Compiler_thread()) { 515 CompilerThread* t = (CompilerThread*)_thread; 516 if (t->task()) { 517 st->cr(); 518 st->print_cr("Current CompileTask:"); 519 t->task()->print_line_on_error(st, buf, sizeof(buf)); 520 st->cr(); 521 } 522 } 523 524 525 STEP(200, "(printing stack bounds)" ) 526 527 if (_verbose) { 528 st->print("Stack: "); 529 530 address stack_top; 531 size_t stack_size; 532 533 if (_thread) { 534 stack_top = _thread->stack_base(); 535 stack_size = _thread->stack_size(); 536 } else { 537 stack_top = os::current_stack_base(); 538 stack_size = os::current_stack_size(); 539 } 540 541 address stack_bottom = stack_top - stack_size; 542 st->print("[" PTR_FORMAT "," PTR_FORMAT "]", p2i(stack_bottom), p2i(stack_top)); 543 544 frame fr = _context ? os::fetch_frame_from_context(_context) 545 : os::current_frame(); 546 547 if (fr.sp()) { 548 st->print(", sp=" PTR_FORMAT, p2i(fr.sp())); 549 size_t free_stack_size = pointer_delta(fr.sp(), stack_bottom, 1024); 550 st->print(", free space=" SIZE_FORMAT "k", free_stack_size); 551 } 552 553 st->cr(); 554 } 555 556 STEP(210, "(printing native stack)" ) 557 558 if (_verbose) { 559 if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { 560 // We have printed the native stack in platform-specific code 561 // Windows/x64 needs special handling. 562 } else { 563 frame fr = _context ? os::fetch_frame_from_context(_context) 564 : os::current_frame(); 565 566 print_native_stack(st, fr, _thread, buf, sizeof(buf)); 567 } 568 } 569 570 STEP(220, "(printing Java stack)" ) 571 572 if (_verbose && _thread && _thread->is_Java_thread()) { 573 print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); 574 } 575 576 STEP(230, "(printing target Java thread stack)" ) 577 578 // printing Java thread stack trace if it is involved in GC crash 579 if (_verbose && _thread && (_thread->is_Named_thread())) { 580 JavaThread* jt = ((NamedThread )_thread)->processed_thread(); 581 if (jt != NULL) { 582 st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id()); 583 print_stack_trace(st, jt, buf, sizeof(buf), true); 584 } 585 } 586 587 STEP(240, "(printing siginfo)" ) 588 589 // signal no, signal code, address that caused the fault 590 if (_verbose && _siginfo) { 591 st->cr(); 592 os::print_siginfo(st, _siginfo); 593 st->cr(); 594 } 595 596 STEP(250, "(printing register info)") 597 598 // decode register contents if possible 599 if (_verbose && _context && Universe::is_fully_initialized()) { 600 os::print_register_info(st, _context); 601 st->cr(); 602 } 603 604 STEP(260, "(printing registers, top of stack, instructions near pc)") 605 606 // registers, top of stack, instructions near pc 607 if (_verbose && _context) { 608 os::print_context(st, _context); 609 st->cr(); 610 } 611 612 STEP(265, "(printing code blob if possible)") 613 614 if (_verbose && _context) { 615 CodeBlob cb = CodeCache::find_blob(_pc); 616 if (cb != NULL) { 617 if (Interpreter::contains(_pc)) { 618 // The interpreter CodeBlob is very large so try to print the codelet instead. 619 InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc); 620 if (codelet != NULL) { 621 codelet->print_on(st); 622 Disassembler::decode(codelet->code_begin(), codelet->code_end(), st); 623 } 624 } else { 625 StubCodeDesc* desc = StubCodeDesc::desc_for(_pc); 626 if (desc != NULL) { 627 desc->print_on(st); 628 Disassembler::decode(desc->begin(), desc->end(), st); 629 } else { 630 Disassembler::decode(cb, st); 631 st->cr(); 632 } 633 } 634 } 635 } 636 637 STEP(270, "(printing VM operation)" ) 638 639 if (_verbose && _thread && _thread->is_VM_thread()) { 640 VMThread* t = (VMThread*)_thread; 641 VM_Operation* op = t->vm_operation(); 642 if (op) { 643 op->print_on_error(st); 644 st->cr(); 645 st->cr(); 646 } 647 } 648 649 STEP(280, "(printing process)" ) 650 651 if (_verbose) { 652 st->cr(); 653 st->print_cr("--------------- P R O C E S S ---------------"); 654 st->cr(); 655 } 656 657 STEP(290, "(printing all threads)" ) 658 659 // all threads 660 if (_verbose && _thread) { 661 Threads::print_on_error(st, _thread, buf, sizeof(buf)); 662 st->cr(); 663 } 664 665 STEP(300, "(printing VM state)" ) 666 667 if (_verbose) { 668 // Safepoint state 669 st->print("VM state:"); 670 671 if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing"); 672 else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint"); 673 else st->print("not at safepoint"); 674 675 // Also see if error occurred during initialization or shutdown 676 if (!Universe::is_fully_initialized()) { 677 st->print(" (not fully initialized)"); 678 } else if (VM_Exit::vm_exited()) { 679 st->print(" (shutting down)"); 680 } else { 681 st->print(" (normal execution)"); 682 } 683 st->cr(); 684 st->cr(); 685 } 686 687 STEP(310, "(printing owned locks on error)" ) 688 689 // mutexes/monitors that currently have an owner 690 if (_verbose) { 691 print_owned_locks_on_error(st); 692 st->cr(); 693 } 694 695 STEP(320, "(printing number of OutOfMemoryError and StackOverflow exceptions)") 696 697 if (_verbose && Exceptions::has_exception_counts()) { 698 st->print_cr("OutOfMemory and StackOverflow Exception counts:"); 699 Exceptions::print_exception_counts_on_error(st); 700 st->cr(); 701 } 702 703 STEP(330, "(printing compressed oops mode") 704 705 if (_verbose && UseCompressedOops) { 706 Universe::print_compressed_oops_mode(st); 707 if (UseCompressedClassPointers) { 708 Metaspace::print_compressed_class_space(st); 709 } 710 st->cr(); 711 } 712 713 STEP(340, "(printing heap information)" ) 714 715 if (_verbose && Universe::is_fully_initialized()) { 716 Universe::heap()->print_on_error(st); 717 st->cr(); 718 719 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); 720 st->cr(); 721 } 722 723 STEP(350, "(printing code cache information)" ) 724 725 if (_verbose && Universe::is_fully_initialized()) { 726 // print code cache information before vm abort 727 CodeCache::print_summary(st); 728 st->cr(); 729 } 730 731 STEP(360, "(printing ring buffers)" ) 732 733 if (_verbose) { 734 Events::print_all(st); 735 st->cr(); 736 } 737 738 STEP(370, "(printing dynamic libraries)" ) 739 740 if (_verbose) { 741 // dynamic libraries, or memory map 742 os::print_dll_info(st); 743 st->cr(); 744 } 745 746 STEP(380, "(printing VM options)" ) 747 748 if (_verbose) { 749 // VM options 750 Arguments::print_on(st); 751 st->cr(); 752 } 753 754 STEP(390, "(printing warning if internal testing API used)" ) 755 756 if (WhiteBox::used()) { 757 st->print_cr("Unsupported internal testing APIs have been used."); 758 st->cr(); 759 } 760 761 STEP(400, "(printing all environment variables)" ) 762 763 if (_verbose) { 764 os::print_environment_variables(st, env_list); 765 st->cr(); 766 } 767 768 STEP(410, "(printing signal handlers)" ) 769 770 if (_verbose) { 771 os::print_signal_handlers(st, buf, sizeof(buf)); 772 st->cr(); 773 } 774 775 STEP(420, "(Native Memory Tracking)" ) 776 if (_verbose) { 777 MemTracker::error_report(st); 778 } 779 780 STEP(430, "(printing system)" ) 781 782 if (_verbose) { 783 st->cr(); 784 st->print_cr("--------------- S Y S T E M ---------------"); 785 st->cr(); 786 } 787 788 STEP(440, "(printing OS information)" ) 789 790 if (_verbose) { 791 os::print_os_info(st); 792 st->cr(); 793 } 794 795 STEP(450, "(printing CPU info)" ) 796 if (_verbose) { 797 os::print_cpu_info(st, buf, sizeof(buf)); 798 st->cr(); 799 } 800 801 STEP(460, "(printing memory info)" ) 802 803 if (_verbose) { 804 os::print_memory_info(st); 805 st->cr(); 806 } 807 808 STEP(470, "(printing internal vm info)" ) 809 810 if (_verbose) { 811 st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); 812 st->cr(); 813 } 814 815 // print a defined marker to show that error handling finished correctly. 816 STEP(480, "(printing end marker)" ) 817 818 if (_verbose) { 819 st->print_cr("END."); 820 } 821 822 END 823 824 # undef BEGIN 825 # undef STEP 826 # undef END 827 } 828

829 volatile intptr_t VMError::first_error_tid = -1; 830 831 // An error could happen before tty is initialized or after it has been 832 // destroyed. Here we use a very simple unbuffered fdStream for printing. 833 // Only out.print_raw() and out.print_raw_cr() should be used, as other 834 // printing methods need to allocate large buffer on stack. To format a 835 // string, use jio_snprintf() with a static buffer or use staticBufferStream. 836 fdStream VMError::out(defaultStream::output_fd()); 837 fdStream VMError::log; // error log used by VMError::report_and_die() 838 839 /** Expand a pattern into a buffer starting at pos and open a file using constructed path / 840 static int expand_and_open(const char pattern, char* buf, size_t buflen, size_t pos) { 841 int fd = -1; 842 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { 843 // the O_EXCL flag will cause the open to fail if the file exists 844 fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); 845 } 846 return fd; 847 } 848


871 fd = expand_and_open(default_pattern, buf, buflen, pos); 872 } 873 } 874 } 875 876 // try temp directory if it exists. 877 if (fd == -1) { 878 const char* tmpdir = os::get_temp_directory(); 879 if (tmpdir != NULL && strlen(tmpdir) > 0) { 880 int pos = jio_snprintf(buf, buflen, "%s%s", tmpdir, os::file_separator()); 881 if (pos > 0) { 882 fd = expand_and_open(default_pattern, buf, buflen, pos); 883 } 884 } 885 } 886 887 return fd; 888 } 889 890 int VMError::_id;

891 const char* VMError::_message; 892 char VMError::_detail_msg[1024]; 893 Thread* VMError::_thread; 894 address VMError::_pc; 895 void* VMError::_siginfo; 896 void* VMError::_context; 897 const char* VMError::_filename; 898 int VMError::_lineno; 899 size_t VMError::_size; 900

901 void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, 902 void* context, const char* detail_fmt, ...) 903 { 904 va_list detail_args; 905 va_start(detail_args, detail_fmt); 906 report_and_die(sig, NULL, detail_fmt, detail_args, thread, pc, siginfo, context, NULL, 0, 0); 907 va_end(detail_args); 908 } 909 910 void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) 911 { 912 report_and_die(thread, sig, pc, siginfo, context, "%s", ""); 913 } 914 915 void VMError::report_and_die(const char* message, const char* detail_fmt, ...) 916 { 917 va_list detail_args; 918 va_start(detail_args, detail_fmt); 919 report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, NULL, NULL, NULL, NULL, NULL, 0, 0); 920 va_end(detail_args);


943 // Don't allocate large buffer on stack 944 static char buffer[O_BUFLEN]; 945 946 // How many errors occurred in error handler when reporting first_error. 947 static int recursive_error_count; 948 949 // We will first print a brief message to standard out (verbose = false), 950 // then save detailed information in log file (verbose = true). 951 static bool out_done = false; // done printing to standard out 952 static bool log_done = false; // done saving error log 953 static bool transmit_report_done = false; // done error reporting 954 955 if (SuppressFatalErrorMessage) { 956 os::abort(CreateCoredumpOnCrash); 957 } 958 intptr_t mytid = os::current_thread_id(); 959 if (first_error_tid == -1 && 960 Atomic::cmpxchg_ptr(mytid, &first_error_tid, -1) == -1) { 961 962 _id = id;

963 _message = message; 964 _thread = thread; 965 _pc = pc; 966 _siginfo = siginfo; 967 _context = context; 968 _filename = filename; 969 _lineno = lineno; 970 _size = size; 971 jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args); 972 973 // first time 974 set_error_reported(); 975 976 if (ShowMessageBoxOnError || PauseAtExit) { 977 show_message_box(buffer, sizeof(buffer)); 978 979 // User has asked JVM to abort. Reset ShowMessageBoxOnError so the 980 // WatcherThread can kill JVM if the error handler hangs. 981 ShowMessageBoxOnError = false; 982 }



208 st->print_cr("# Possible solutions:"); 209 st->print_cr("# Reduce memory load on the system"); 210 st->print_cr("# Increase physical memory or swap space"); 211 st->print_cr("# Check if swap backing store is full"); 212 st->print_cr("# Use 64 bit Java on a 64 bit OS"); 213 st->print_cr("# Decrease Java heap size (-Xmx/-Xms)"); 214 st->print_cr("# Decrease number of Java threads"); 215 st->print_cr("# Decrease Java thread stack sizes (-Xss)"); 216 st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize="); 217 st->print_cr("# This output file may be truncated or incomplete."); 218 } 219 220 const char* VMError::gc_mode() { 221 if (UseG1GC) return "g1 gc"; 222 if (UseParallelGC) return "parallel gc"; 223 if (UseConcMarkSweepGC) return "concurrent mark sweep gc"; 224 if (UseSerialGC) return "serial gc"; 225 return "ERROR in GC mode"; 226 } 227 228 void VMError::report_vm_version(outputStream* st, char* buf, int buflen) { 229 // VM version 230 st->print_cr("#"); 231 JDK_Version::current().to_string(buf, buflen); 232 const char* runtime_name = JDK_Version::runtime_name() != NULL ? 233 JDK_Version::runtime_name() : ""; 234 const char* runtime_version = JDK_Version::runtime_version() != NULL ? 235 JDK_Version::runtime_version() : ""; 236 st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version); 237 // This is the long version with some default settings added 238 st->print_cr("# Java VM: %s (%s, %s%s%s%s%s, %s, %s)", 239 Abstract_VM_Version::vm_name(), 240 Abstract_VM_Version::vm_release(), 241 Abstract_VM_Version::vm_info_string(), 242 TieredCompilation ? ", tiered" : "", 243 #if INCLUDE_JVMCI 244 EnableJVMCI ? ", jvmci" : "", 245 UseJVMCICompiler ? ", jvmci compiler" : "", 246 #else 247 "", "", 248 #endif 249 UseCompressedOops ? ", compressed oops" : "", 250 gc_mode(), 251 Abstract_VM_Version::vm_platform_string() 252 ); 253 } 254 255 // This is the main function to report a fatal error. Only one thread can 256 // call this function, so we don't need to worry about MT-safety. But it's 257 // possible that the error handler itself may crash or die on an internal 258 // error, for example, when the stack/heap is badly damaged. We must be 259 // able to handle recursive errors that happen inside error handler. 260 // 261 // Error reporting is done in several steps. If a crash or internal error 262 // occurred when reporting an error, the nested signal/exception handler 263 // can skip steps that are already (or partially) done. Error reporting will 264 // continue from the next step. This allows us to retrieve and print 265 // information that may be unsafe to get after a fatal error. If it happens, 266 // you may find nested report_and_die() frames when you look at the stack 267 // in a debugger. 268 // 269 // In general, a hang in error handler is much worse than a crash or internal 270 // error, as it's harder to recover from a hang. Deadlock can happen if we 271 // try to grab a lock that is already owned by current thread, or if the 272 // owner is blocked forever (e.g. in os::infinite_sleep()). If possible, the 273 // error handler and all the functions it called should avoid grabbing any 274 // lock. An important thing to notice is that memory allocation needs a lock. 275 // 276 // We should avoid using large stack allocated buffers. Many errors happen 277 // when stack space is already low. Making things even worse is that there 278 // could be nested report_and_die() calls on stack (see above). Only one 279 // thread can report error, so large buffers are statically allocated in data 280 // segment. 281 282 int VMError::_current_step; 283 const char* VMError::_current_step_info; 284 # define STEP(n, s) } if (_current_step < n) { if (!_vm_info_cmd) { _current_step = n; _current_step_info = s; } 285 # define BEGIN if (_current_step == 0) { if (!_vm_info_cmd) { _current_step = 1; } 286 # define END } 287 288 void VMError::report_summary(outputStream* st, char* buf, int buflen) { 289 290 BEGIN

291 292 // Summary reports are in the 200s. 293 STEP(200, "(printing summary)" ) 294 295 st->cr(); 296 st->print_cr("--------------- S U M M A R Y ------------"); 297 st->cr(); 298 299 STEP(210, "(printing VM option summary)" ) 300 301 // VM options 302 Arguments::print_summary_on(st); 303 st->cr(); 304 305 STEP(220, "(printing summary machine and OS info)") 306 307 os::print_summary_info(st, buf, sizeof(buf)); 308 309 STEP(230, "(printing date and time)" ) 310 311 os::print_date_and_time(st, buf, sizeof(buf)); 312 END 313 } 314 315 void VMError::report_process(outputStream* st, char* buf, int buflen) { 316 317 BEGIN 318 STEP(500, "(printing process)" ) 319 320 st->cr(); 321 st->print_cr("--------------- P R O C E S S ---------------"); 322 st->cr(); 323 324 STEP(510, "(printing all threads)" ) 325 326 // all threads 327 if (_thread) { 328 Threads::print_on_error(st, _thread, buf, buflen); 329 st->cr(); 330 } 331 332 STEP(520, "(printing VM state)" ) 333 334 // Safepoint state 335 st->print("VM state:"); 336 337 if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing"); 338 else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint"); 339 else st->print("not at safepoint"); 340 341 // Also see if error occurred during initialization or shutdown 342 if (!Universe::is_fully_initialized()) { 343 st->print(" (not fully initialized)"); 344 } else if (VM_Exit::vm_exited()) { 345 st->print(" (shutting down)"); 346 } else { 347 st->print(" (normal execution)");

348 } 349 st->cr(); 350 st->cr(); 351 352 STEP(530, "(printing owned locks on error)" ) 353 354 // mutexes/monitors that currently have an owner 355 print_owned_locks_on_error(st); 356 st->cr(); 357 358 STEP(540, "(printing number of OutOfMemoryError and StackOverflow exceptions)") 359 360 if (Exceptions::has_exception_counts()) { 361 st->print_cr("OutOfMemory and StackOverflow Exception counts:"); 362 Exceptions::print_exception_counts_on_error(st); 363 st->cr(); 364 } 365 366 STEP(550, "(printing compressed oops mode") 367 368 if (UseCompressedOops) { 369 Universe::print_compressed_oops_mode(st); 370 if (UseCompressedClassPointers) { 371 Metaspace::print_compressed_class_space(st); 372 } 373 st->cr(); 374 } 375 376 STEP(560, "(printing heap information)" ) 377 378 if (Universe::is_fully_initialized()) { 379 Universe::heap()->print_on_error(st); 380 st->cr(); 381 382 st->print_cr("Polling page: " INTPTR_FORMAT, p2i(os::get_polling_page())); 383 st->cr(); 384 } 385 386 STEP(570, "(printing code cache information)" ) 387 388 if (Universe::is_fully_initialized()) { 389 // print code cache information before vm abort 390 CodeCache::print_summary(st); 391 st->cr(); 392 } 393 394 STEP(580, "(printing ring buffers)" ) 395 396 Events::print_all(st); 397 st->cr(); 398 399 STEP(590, "(printing dynamic libraries)" ) 400 401 // dynamic libraries, or memory map 402 os::print_dll_info(st); 403 st->cr(); 404 405 STEP(600, "(printing VM options)" ) 406 407 // VM options 408 Arguments::print_on(st); 409 st->cr(); 410 411 STEP(610, "(printing warning if internal testing API used)" ) 412 413 if (WhiteBox::used()) { 414 st->print_cr("Unsupported internal testing APIs have been used."); 415 st->cr(); 416 } 417 418 STEP(620, "(printing all environment variables)" ) 419 420 os::print_environment_variables(st, env_list); 421 st->cr(); 422 423 STEP(630, "(printing signal handlers)" ) 424 425 os::print_signal_handlers(st, buf, buflen); 426 st->cr(); 427 428 STEP(640, "(Native Memory Tracking)" ) 429 MemTracker::error_report(st); 430 431 END 432 } 433 434 void VMError::report_system(outputStream* st, char* buf, int buflen) { 435 436 BEGIN 437 STEP(700, "(printing system)" ) 438 439 st->cr(); 440 st->print_cr("--------------- S Y S T E M ---------------"); 441 st->cr(); 442 443 STEP(710, "(printing OS information)" ) 444 445 os::print_os_info(st); 446 st->cr(); 447 448 STEP(720, "(printing CPU info)" ) 449 os::print_cpu_info(st, buf, buflen); 450 st->cr(); 451 452 STEP(730, "(printing memory info)" ) 453 454 os::print_memory_info(st); 455 st->cr(); 456 457 STEP(740, "(printing internal vm info)" ) 458 459 st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); 460 st->cr(); 461 462 END 463 } 464 465 #ifndef PRODUCT 466 void VMError::run_report_tests(outputStream* st) { 467 BEGIN 468 // test secondary error handling. Test it twice, to test that resetting 469 // error handler after a secondary crash works. 470 STEP(20, "(test secondary crash 1)") 471 if (TestCrashInErrorHandler != 0) { 472 st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", 473 TestCrashInErrorHandler); 474 controlled_crash(TestCrashInErrorHandler); 475 } 476 477 STEP(30, "(test secondary crash 2)") 478 if (TestCrashInErrorHandler != 0) { 479 st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", 480 TestCrashInErrorHandler); 481 controlled_crash(TestCrashInErrorHandler); 482 } 483 484 STEP(40, "(test safefetch in error handler)") 485 // test whether it is safe to use SafeFetch32 in Crash Handler. Test twice 486 // to test that resetting the signal handler works correctly. 487 if (TestSafeFetchInErrorHandler) { 488 st->print_cr("Will test SafeFetch..."); 489 if (CanUseSafeFetch32()) { 490 int* const invalid_pointer = (int*) get_segfault_address(); 491 const int x = 0x76543210; 492 int i1 = SafeFetch32(invalid_pointer, x); 493 int i2 = SafeFetch32(invalid_pointer, x); 494 if (i1 == x && i2 == x) { 495 st->print_cr("SafeFetch OK."); // Correctly deflected and returned default pattern 496 } else { 497 st->print_cr("??"); 498 } 499 } else { 500 st->print_cr("not possible; skipped."); 501 } 502 } 503 END 504 } 505 #endif // PRODUCT 506 507 // Main error reporting function. 508 void VMError::report(outputStream* st, bool _verbose) { 509 510 // don't allocate large buffer on stack 511 static char buf[O_BUFLEN]; 512 513 BEGIN 514 STEP(10, "(printing fatal error message)") 515 516 st->print_cr("#"); 517 if (should_report_bug(_id)) { 518 st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); 519 } else { 520 st->print_cr("# There is insufficient memory for the Java " 521 "Runtime Environment to continue."); 522 } 523 524 #ifndef PRODUCT 525 // Error handler self tests Step 20-40 526 if (_verbose) { 527 run_report_tests(st); 528 } 529 #endif // PRODUCT 530 531 STEP(50, "(printing type of error)") 532 533 switch(_id) { 534 case OOM_MALLOC_ERROR: 535 case OOM_MMAP_ERROR: 536 if (_size) { 537 st->print("# Native memory allocation "); 538 st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " : 539 "(mmap) failed to map "); 540 jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size); 541 st->print("%s", buf); 542 st->print(" bytes"); 543 if (strlen(_detail_msg) > 0) { 544 st->print(" for "); 545 st->print("%s", _detail_msg); 546 } 547 st->cr(); 548 } else { 549 if (strlen(_detail_msg) > 0) { 550 st->print("# "); 551 st->print_cr("%s", _detail_msg); 552 } 553 } 554 // In error file give some solutions 555 if (_verbose) { 556 print_oom_reasons(st); 557 } else { 558 return; // that's enough for the screen 559 } 560 break; 561 case VM_INFO: 562 case INTERNAL_ERROR: 563 default: 564 break; 565 } 566 567 STEP(60, "(printing exception/signal name)") 568 569 st->print_cr("#"); 570 st->print("# "); 571 // Is it an OS exception/signal? 572 if (os::exception_name(_id, buf, sizeof(buf))) { 573 st->print("%s", buf); 574 st->print(" (0x%x)", _id); // signal number 575 st->print(" at pc=" PTR_FORMAT, p2i(_pc)); 576 } else { 577 if (should_report_bug(_id)) { 578 st->print("Internal Error"); 579 } else { 580 st->print("Out of Memory Error"); 581 }


598 599 // process id, thread id 600 st->print(", pid=%d", os::current_process_id()); 601 st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); 602 st->cr(); 603 604 STEP(80, "(printing error message)") 605 606 if (should_report_bug(_id)) { // already printed the message. 607 // error message 608 if (strlen(_detail_msg) > 0) { 609 st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg); 610 } else if (_message) { 611 st->print_cr("# Error: %s", _message); 612 } 613 } 614 615 STEP(90, "(printing Java version string)") 616 617 // VM version 618 report_vm_version(st, buf, sizeof(buf));

619 620 STEP(100, "(printing problematic frame)") 621 622 // Print current frame if we have a context (i.e. it's a crash) 623 if (_context) { 624 st->print_cr("# Problematic frame:"); 625 st->print("# "); 626 frame fr = os::fetch_frame_from_context(_context); 627 fr.print_on_error(st, buf, sizeof(buf)); 628 st->cr(); 629 st->print_cr("#"); 630 } 631 632 STEP(110, "(printing core file information)") 633 st->print("# "); 634 if (CreateCoredumpOnCrash) { 635 if (coredump_status) { 636 st->print("Core dump will be written. Default location: %s", coredump_message); 637 } else { 638 st->print("No core dump will be written. %s", coredump_message); 639 } 640 } else { 641 st->print("CreateCoredumpOnCrash turned off, no core file dumped"); 642 } 643 st->cr(); 644 st->print_cr("#"); 645 646 STEP(120, "(printing bug submit message)") 647 648 if (should_report_bug(_id) && _verbose) { 649 print_bug_submit_message(st, _thread); 650 } 651

652 653 // SUMMARY 654 // Step 200-290 655 if (_verbose) { 656 report_summary(st, buf, sizeof(buf)); 657 } 658 659 STEP(300, "(printing thread)" ) 660 661 if (_verbose) { 662 st->cr(); 663 st->print_cr("--------------- T H R E A D ---------------"); 664 st->cr(); 665 } 666 667 STEP(310, "(printing current thread)" ) 668 669 // current thread 670 if (_verbose) { 671 if (_thread) { 672 st->print("Current thread (" PTR_FORMAT "): ", p2i(_thread)); 673 _thread->print_on_error(st, buf, sizeof(buf)); 674 st->cr(); 675 } else { 676 st->print_cr("Current thread is native thread"); 677 } 678 st->cr(); 679 } 680 681 STEP(320, "(printing current compile task)" ) 682 683 if (_verbose && _thread && _thread->is_Compiler_thread()) { 684 CompilerThread* t = (CompilerThread*)_thread; 685 if (t->task()) { 686 st->cr(); 687 st->print_cr("Current CompileTask:"); 688 t->task()->print_line_on_error(st, buf, sizeof(buf)); 689 st->cr(); 690 } 691 } 692 693 694 STEP(330, "(printing stack bounds)" ) 695 696 if (_verbose) { 697 st->print("Stack: "); 698 699 address stack_top; 700 size_t stack_size; 701 702 if (_thread) { 703 stack_top = _thread->stack_base(); 704 stack_size = _thread->stack_size(); 705 } else { 706 stack_top = os::current_stack_base(); 707 stack_size = os::current_stack_size(); 708 } 709 710 address stack_bottom = stack_top - stack_size; 711 st->print("[" PTR_FORMAT "," PTR_FORMAT "]", p2i(stack_bottom), p2i(stack_top)); 712 713 frame fr = _context ? os::fetch_frame_from_context(_context) 714 : os::current_frame(); 715 716 if (fr.sp()) { 717 st->print(", sp=" PTR_FORMAT, p2i(fr.sp())); 718 size_t free_stack_size = pointer_delta(fr.sp(), stack_bottom, 1024); 719 st->print(", free space=" SIZE_FORMAT "k", free_stack_size); 720 } 721 722 st->cr(); 723 } 724 725 STEP(340, "(printing native stack)" ) 726 727 if (_verbose) { 728 if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { 729 // We have printed the native stack in platform-specific code 730 // Windows/x64 needs special handling. 731 } else { 732 frame fr = _context ? os::fetch_frame_from_context(_context) 733 : os::current_frame(); 734 735 print_native_stack(st, fr, _thread, buf, sizeof(buf)); 736 } 737 } 738 739 STEP(350, "(printing Java stack)" ) 740 741 if (_verbose && _thread && _thread->is_Java_thread()) { 742 print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); 743 } 744 745 STEP(360, "(printing target Java thread stack)" ) 746 747 // printing Java thread stack trace if it is involved in GC crash 748 if (_verbose && _thread && (_thread->is_Named_thread())) { 749 JavaThread* jt = ((NamedThread )_thread)->processed_thread(); 750 if (jt != NULL) { 751 st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id()); 752 print_stack_trace(st, jt, buf, sizeof(buf), true); 753 } 754 } 755 756 STEP(370, "(printing siginfo)" ) 757 758 // signal no, signal code, address that caused the fault 759 if (_verbose && _siginfo) { 760 st->cr(); 761 os::print_siginfo(st, _siginfo); 762 st->cr(); 763 } 764 765 STEP(380, "(printing register info)") 766 767 // decode register contents if possible 768 if (_verbose && _context && Universe::is_fully_initialized()) { 769 os::print_register_info(st, _context); 770 st->cr(); 771 } 772 773 STEP(390, "(printing registers, top of stack, instructions near pc)") 774 775 // registers, top of stack, instructions near pc 776 if (_verbose && _context) { 777 os::print_context(st, _context); 778 st->cr(); 779 } 780 781 STEP(400, "(printing code blob if possible)") 782 783 if (_verbose && _context) { 784 CodeBlob cb = CodeCache::find_blob(_pc); 785 if (cb != NULL) { 786 if (Interpreter::contains(_pc)) { 787 // The interpreter CodeBlob is very large so try to print the codelet instead. 788 InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc); 789 if (codelet != NULL) { 790 codelet->print_on(st); 791 Disassembler::decode(codelet->code_begin(), codelet->code_end(), st); 792 } 793 } else { 794 StubCodeDesc* desc = StubCodeDesc::desc_for(_pc); 795 if (desc != NULL) { 796 desc->print_on(st); 797 Disassembler::decode(desc->begin(), desc->end(), st); 798 } else { 799 Disassembler::decode(cb, st); 800 st->cr(); 801 } 802 } 803 } 804 } 805 806 STEP(410, "(printing VM operation)" ) 807 808 if (_verbose && _thread && _thread->is_VM_thread()) { 809 VMThread* t = (VMThread*)_thread; 810 VM_Operation* op = t->vm_operation(); 811 if (op) { 812 op->print_on_error(st); 813 st->cr(); 814 st->cr(); 815 } 816 } 817

818 if (_verbose) { 819 // PROCESS 820 // Step 500-690 821 report_process(st, buf, sizeof(buf)); 822 823 // SYSTEM 824 // Step 700-790 825 report_system(st, buf, sizeof(buf));

826 } 827 828 // print a defined marker to show that error handling finished correctly. 829 STEP(800, "(printing end marker)" ) 830 831 if (_verbose) { 832 st->print_cr("END."); 833 } 834 835 END 836 837 # undef BEGIN 838 # undef STEP 839 # undef END 840 } 841 842 // Report for the vm_info_cmd, skipping crash specific code 843 void VMError::report_info(outputStream* st) { 844 845 // don't allocate large buffer on stack 846 static char buf[O_BUFLEN]; 847 848 st->print_cr("# pid=%d", os::current_process_id()); 849 report_vm_version(st, buf, sizeof(buf)); 850 report_summary(st, buf, sizeof(buf)); 851 report_process(st, buf, sizeof(buf)); 852 report_system(st, buf, sizeof(buf)); 853 st->print_cr("END."); 854 } 855 856 volatile intptr_t VMError::first_error_tid = -1; 857 858 // An error could happen before tty is initialized or after it has been 859 // destroyed. Here we use a very simple unbuffered fdStream for printing. 860 // Only out.print_raw() and out.print_raw_cr() should be used, as other 861 // printing methods need to allocate large buffer on stack. To format a 862 // string, use jio_snprintf() with a static buffer or use staticBufferStream. 863 fdStream VMError::out(defaultStream::output_fd()); 864 fdStream VMError::log; // error log used by VMError::report_and_die() 865 866 /** Expand a pattern into a buffer starting at pos and open a file using constructed path / 867 static int expand_and_open(const char pattern, char* buf, size_t buflen, size_t pos) { 868 int fd = -1; 869 if (Arguments::copy_expand_pid(pattern, strlen(pattern), &buf[pos], buflen - pos)) { 870 // the O_EXCL flag will cause the open to fail if the file exists 871 fd = open(buf, O_RDWR | O_CREAT | O_EXCL, 0666); 872 } 873 return fd; 874 } 875


898 fd = expand_and_open(default_pattern, buf, buflen, pos); 899 } 900 } 901 } 902 903 // try temp directory if it exists. 904 if (fd == -1) { 905 const char* tmpdir = os::get_temp_directory(); 906 if (tmpdir != NULL && strlen(tmpdir) > 0) { 907 int pos = jio_snprintf(buf, buflen, "%s%s", tmpdir, os::file_separator()); 908 if (pos > 0) { 909 fd = expand_and_open(default_pattern, buf, buflen, pos); 910 } 911 } 912 } 913 914 return fd; 915 } 916 917 int VMError::_id; 918 bool VMError::_vm_info_cmd; 919 const char* VMError::_message; 920 char VMError::_detail_msg[1024]; 921 Thread* VMError::_thread; 922 address VMError::_pc; 923 void* VMError::_siginfo; 924 void* VMError::_context; 925 const char* VMError::_filename; 926 int VMError::_lineno; 927 size_t VMError::_size; 928 929 void VMError::print_vm_info(outputStream* st) { 930 _id = VM_INFO; 931 _vm_info_cmd = true; 932 _message = NULL; 933 _thread = NULL; 934 _pc = NULL; 935 _siginfo = NULL; 936 _context = NULL; 937 _filename = NULL; 938 _lineno = 0; 939 _size = 0; 940 _detail_msg[0] = 0; 941 report_info(st); 942 } 943 944 void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, 945 void* context, const char* detail_fmt, ...) 946 { 947 va_list detail_args; 948 va_start(detail_args, detail_fmt); 949 report_and_die(sig, NULL, detail_fmt, detail_args, thread, pc, siginfo, context, NULL, 0, 0); 950 va_end(detail_args); 951 } 952 953 void VMError::report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo, void* context) 954 { 955 report_and_die(thread, sig, pc, siginfo, context, "%s", ""); 956 } 957 958 void VMError::report_and_die(const char* message, const char* detail_fmt, ...) 959 { 960 va_list detail_args; 961 va_start(detail_args, detail_fmt); 962 report_and_die(INTERNAL_ERROR, message, detail_fmt, detail_args, NULL, NULL, NULL, NULL, NULL, 0, 0); 963 va_end(detail_args);


986 // Don't allocate large buffer on stack 987 static char buffer[O_BUFLEN]; 988 989 // How many errors occurred in error handler when reporting first_error. 990 static int recursive_error_count; 991 992 // We will first print a brief message to standard out (verbose = false), 993 // then save detailed information in log file (verbose = true). 994 static bool out_done = false; // done printing to standard out 995 static bool log_done = false; // done saving error log 996 static bool transmit_report_done = false; // done error reporting 997 998 if (SuppressFatalErrorMessage) { 999 os::abort(CreateCoredumpOnCrash); 1000 } 1001 intptr_t mytid = os::current_thread_id(); 1002 if (first_error_tid == -1 && 1003 Atomic::cmpxchg_ptr(mytid, &first_error_tid, -1) == -1) { 1004 1005 _id = id; 1006 _vm_info_cmd = false; 1007 _message = message; 1008 _thread = thread; 1009 _pc = pc; 1010 _siginfo = siginfo; 1011 _context = context; 1012 _filename = filename; 1013 _lineno = lineno; 1014 _size = size; 1015 jio_vsnprintf(_detail_msg, sizeof(_detail_msg), detail_fmt, detail_args); 1016 1017 // first time 1018 set_error_reported(); 1019 1020 if (ShowMessageBoxOnError || PauseAtExit) { 1021 show_message_box(buffer, sizeof(buffer)); 1022 1023 // User has asked JVM to abort. Reset ShowMessageBoxOnError so the 1024 // WatcherThread can kill JVM if the error handler hangs. 1025 ShowMessageBoxOnError = false; 1026 }