< prev index next >

src/share/vm/utilities/vmError.hpp

Print this page
rev 12487 : 8166944: Hanging Error Reporting steps may lead to torn error logs.
Reviewed-by: cjplummer, dholmes
Summary: Interupt error reporting if reporting steps hang to enable subsequent reporting steps to run.
   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  87 
  88   // generate a stack trace
  89   static void print_stack_trace(outputStream* st, JavaThread* jt,
  90                                 char* buf, int buflen, bool verbose = false);
  91 
  92   static bool should_report_bug(unsigned int id) {
  93     return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
  94   }
  95 
  96   // Write a hint to the stream in case siginfo relates to a segv/bus error
  97   // and the offending address points into CDS store.
  98   static void check_failing_cds_access(outputStream* st, const void* siginfo);
  99 
 100   static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
 101                              void* context, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(6, 7);
 102   static void report_and_die(const char* message, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(2, 3);
 103 
 104   static fdStream out;
 105   static fdStream log; // error log used by VMError::report_and_die()
 106 




 107 public:
 108 
 109   // return a string to describe the error
 110   static char* error_string(char* buf, int buflen);
 111 
 112   // Record status of core/minidump
 113   static void record_coredump_status(const char* message, bool status);
 114 
 115   // support for VM.info diagnostic command
 116   static void print_vm_info(outputStream* st);
 117 
 118   // main error reporting function
 119   static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args,
 120                              Thread* thread, address pc, void* siginfo, void* context,
 121                              const char* filename, int lineno, size_t size) ATTRIBUTE_PRINTF(3, 0);
 122 
 123   static void report_and_die(Thread* thread, unsigned int sig, address pc,
 124                              void* siginfo, void* context);
 125 
 126   static void report_and_die(Thread* thread,const char* filename, int lineno, const char* message,


 130                              VMErrorType vm_err_type, const char* detail_fmt,
 131                              va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 132 
 133   static void report_and_die(const char* message);
 134 
 135   // reporting OutOfMemoryError
 136   static void report_java_out_of_memory(const char* message);
 137 
 138   // returns original flags for signal, if it was resetted, or -1 if
 139   // signal was not changed by error reporter
 140   static int get_resetted_sigflags(int sig);
 141 
 142   // returns original handler for signal, if it was resetted, or NULL if
 143   // signal was not changed by error reporter
 144   static address get_resetted_sighandler(int sig);
 145 
 146   // check to see if fatal error reporting is in progress
 147   static bool fatal_error_in_progress() { return first_error_tid != -1; }
 148 
 149   static intptr_t get_first_error_tid() { return first_error_tid; }





 150 };
 151 
 152 #endif // SHARE_VM_UTILITIES_VMERROR_HPP
   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  87 
  88   // generate a stack trace
  89   static void print_stack_trace(outputStream* st, JavaThread* jt,
  90                                 char* buf, int buflen, bool verbose = false);
  91 
  92   static bool should_report_bug(unsigned int id) {
  93     return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR);
  94   }
  95 
  96   // Write a hint to the stream in case siginfo relates to a segv/bus error
  97   // and the offending address points into CDS store.
  98   static void check_failing_cds_access(outputStream* st, const void* siginfo);
  99 
 100   static void report_and_die(Thread* thread, unsigned int sig, address pc, void* siginfo,
 101                              void* context, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(6, 7);
 102   static void report_and_die(const char* message, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(2, 3);
 103 
 104   static fdStream out;
 105   static fdStream log; // error log used by VMError::report_and_die()
 106 
 107   // Platform dependend helper functions used for timeout handling.
 108   static void reporting_started();
 109   static void interrupt_reporting_thread();
 110 
 111 public:
 112 
 113   // return a string to describe the error
 114   static char* error_string(char* buf, int buflen);
 115 
 116   // Record status of core/minidump
 117   static void record_coredump_status(const char* message, bool status);
 118 
 119   // support for VM.info diagnostic command
 120   static void print_vm_info(outputStream* st);
 121 
 122   // main error reporting function
 123   static void report_and_die(int id, const char* message, const char* detail_fmt, va_list detail_args,
 124                              Thread* thread, address pc, void* siginfo, void* context,
 125                              const char* filename, int lineno, size_t size) ATTRIBUTE_PRINTF(3, 0);
 126 
 127   static void report_and_die(Thread* thread, unsigned int sig, address pc,
 128                              void* siginfo, void* context);
 129 
 130   static void report_and_die(Thread* thread,const char* filename, int lineno, const char* message,


 134                              VMErrorType vm_err_type, const char* detail_fmt,
 135                              va_list detail_args) ATTRIBUTE_PRINTF(6, 0);
 136 
 137   static void report_and_die(const char* message);
 138 
 139   // reporting OutOfMemoryError
 140   static void report_java_out_of_memory(const char* message);
 141 
 142   // returns original flags for signal, if it was resetted, or -1 if
 143   // signal was not changed by error reporter
 144   static int get_resetted_sigflags(int sig);
 145 
 146   // returns original handler for signal, if it was resetted, or NULL if
 147   // signal was not changed by error reporter
 148   static address get_resetted_sighandler(int sig);
 149 
 150   // check to see if fatal error reporting is in progress
 151   static bool fatal_error_in_progress() { return first_error_tid != -1; }
 152 
 153   static intptr_t get_first_error_tid() { return first_error_tid; }
 154 
 155   // Called by WatcherThread to check if the currently running error reporting did timeout.
 156   //  Returns true if reporting did hit the global ErrorLogTimeout.
 157   static bool check_timeout();
 158 
 159 };
 160 
 161 #endif // SHARE_VM_UTILITIES_VMERROR_HPP
< prev index next >