8224793: os::die() does not honor CreateCoredumpOnCrash option
authordcubed
Wed, 05 Jun 2019 14:01:01 -0400
changeset 55238 3bd979f09721
parent 55237 36334808644d
child 55239 74832e7b5cad
8224793: os::die() does not honor CreateCoredumpOnCrash option Reviewed-by: kbarrett, dholmes, stuefe
src/hotspot/os/aix/os_aix.cpp
src/hotspot/os/bsd/os_bsd.cpp
src/hotspot/os/linux/os_linux.cpp
src/hotspot/os/solaris/os_solaris.cpp
src/hotspot/share/runtime/os.hpp
--- a/src/hotspot/os/aix/os_aix.cpp	Wed Jun 05 10:49:09 2019 -0700
+++ b/src/hotspot/os/aix/os_aix.cpp	Wed Jun 05 14:01:01 2019 -0400
@@ -1206,8 +1206,15 @@
 }
 
 // Die immediately, no exit hook, no abort hook, no cleanup.
+// Dump a core file, if possible, for debugging.
 void os::die() {
-  ::abort();
+  if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) {
+    // For TimeoutInErrorHandlingTest.java, we just kill the VM
+    // and don't take the time to generate a core file.
+    os::signal_raise(SIGKILL);
+  } else {
+    ::abort();
+  }
 }
 
 intx os::current_thread_id() {
--- a/src/hotspot/os/bsd/os_bsd.cpp	Wed Jun 05 10:49:09 2019 -0700
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Wed Jun 05 14:01:01 2019 -0400
@@ -1073,9 +1073,16 @@
 }
 
 // Die immediately, no exit hook, no abort hook, no cleanup.
+// Dump a core file, if possible, for debugging.
 void os::die() {
-  // _exit() on BsdThreads only kills current thread
-  ::abort();
+  if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) {
+    // For TimeoutInErrorHandlingTest.java, we just kill the VM
+    // and don't take the time to generate a core file.
+    os::signal_raise(SIGKILL);
+  } else {
+    // _exit() on BsdThreads only kills current thread
+    ::abort();
+  }
 }
 
 // Information of current thread in variety of formats
--- a/src/hotspot/os/linux/os_linux.cpp	Wed Jun 05 10:49:09 2019 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Wed Jun 05 14:01:01 2019 -0400
@@ -1461,8 +1461,15 @@
 }
 
 // Die immediately, no exit hook, no abort hook, no cleanup.
+// Dump a core file, if possible, for debugging.
 void os::die() {
-  ::abort();
+  if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) {
+    // For TimeoutInErrorHandlingTest.java, we just kill the VM
+    // and don't take the time to generate a core file.
+    os::signal_raise(SIGKILL);
+  } else {
+    ::abort();
+  }
 }
 
 // thread_id is kernel thread id (similar to Solaris LWP id)
--- a/src/hotspot/os/solaris/os_solaris.cpp	Wed Jun 05 10:49:09 2019 -0700
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Wed Jun 05 14:01:01 2019 -0400
@@ -1334,8 +1334,15 @@
 }
 
 // Die immediately, no exit hook, no abort hook, no cleanup.
+// Dump a core file, if possible, for debugging.
 void os::die() {
-  ::abort(); // dump core (for debugging)
+  if (TestUnresponsiveErrorHandler && !CreateCoredumpOnCrash) {
+    // For TimeoutInErrorHandlingTest.java, we just kill the VM
+    // and don't take the time to generate a core file.
+    os::signal_raise(SIGKILL);
+  } else {
+    ::abort();
+  }
 }
 
 // DLL functions
--- a/src/hotspot/share/runtime/os.hpp	Wed Jun 05 10:49:09 2019 -0700
+++ b/src/hotspot/share/runtime/os.hpp	Wed Jun 05 14:01:01 2019 -0400
@@ -518,6 +518,10 @@
   static void abort(bool dump_core = true);
 
   // Die immediately, no exit hook, no abort hook, no cleanup.
+  // Dump a core file, if possible, for debugging. os::abort() is the
+  // preferred means to abort the VM on error. os::die() should only
+  // be called if something has gone badly wrong. CreateCoredumpOnCrash
+  // is intentionally not honored by this function.
   static void die();
 
   // File i/o operations