JDK-8338883 : Show warning when CreateCoredumpOnCrash set, but core dump will not happen
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-08-22
  • Updated: 2024-10-21
  • Resolved: 2024-10-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b20Fixed
Description
While investigating MACH5 issue it was helpful to see the status of the core dump logic - this should be part of hotspot.

Being able to tell:

core dump info: core.28283

from

core dump info: Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

eliminates the guesswork and assumptions about whether the system was set up correctly for core dumps.
Comments
Changeset: c34fb2c9 Branch: master Author: Gerard Ziemski <gziemski@openjdk.org> Date: 2024-10-16 15:32:07 +0000 URL: https://git.openjdk.org/jdk/commit/c34fb2c989562206a2506a2fbbfb584e223bb828
16-10-2024

David's feedback: "Not sure it matters but it is customary to put the requires before any actions like build/run/compile" referring to the sequence: * @run driver CreateCoredumpOnCrash * @requires vm.flagless
16-10-2024

Possible followup finessing suggestion from David's review: "You could use ProcessTools.executeProcess("sh", "-c", "ulimit -c"); For that matter there are related utilities in ./lib/jdk/test/lib/util/CoreUtils.java - but maybe not worth trying to adapt to current needs."
16-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20734 Date: 2024-08-27 20:42:48 +0000
27-08-2024

diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index ea18ff3a006..765f2f751d0 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -663,6 +663,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { #endif // INCLUDE_MANAGEMENT log_info(os)("Initialized VM with process ID %d", os::current_process_id()); + if (log_is_enabled(Info, os)) { + char buffer[2048]; + os::check_dump_limit(buffer, sizeof(buffer)); + log_info(os)("core dump info: %s", buffer); + } // Signal Dispatcher needs to be started before VMInit event is posted os::initialize_jdk_signal_support(CHECK_JNI_ERR); diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java index 73efc0e5e46..c13bc716fc2 100644 --- a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -52,15 +52,17 @@ public static void main(String[] args) throws Exception { runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped") .shouldNotHaveExitValue(0); } else { - runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped") - .shouldNotHaveExitValue(0); + OutputAnalyzer oa = runTest("-XX:+CreateCoredumpOnCrash"); + oa.reportDiagnosticSummary(); + oa.shouldContain("core dump info").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped"). + shouldNotHaveExitValue(0); } - } + public static OutputAnalyzer runTest(String option) throws Exception { return new OutputAnalyzer( ProcessTools.createLimitedTestJavaProcessBuilder( - "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName()) + "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", "-Xlog:os=info:stdout", option, Crasher.class.getName()) .start()); } } (END)
22-08-2024