Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8305507

Add support for grace period before AbortVMOnSafepointTimeout triggers

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 22
    • 21
    • hotspot
    • b14

    Description

      From Wojciech KUDLA <wojciech.kudla@hsbc.com>

      Hi everyone,

      Our bank uses Java for low-latency applications and we sometimes need to dig into a long time-to-safepoint pause in greater detail. AbortVMOnSafepointTimeout is extremely useful but we want to avoid putting the JVM in debug while it is still warming up or bootstrapping an application. For that reason we introduced a grace period that avoids triggering the AbortVMOnSafepointTimeout functionality until some preconfigured time after the JVM startup.
      The patch is extremely simple and tangential to the SafepointTimeoutDelay patch we submitted this morning: https://mail.openjdk.org/pipermail/hotspot-dev/2023-April/072455.html
      As stated in that thread - we recently signed the OCA and this is the second of two patches we'd like to contribute; I think it will require someone to sponsor it.
      We're happy to continue discussing this patch here to ensure the change meets the community's requirements.

      ---
       src/hotspot/share/runtime/globals.hpp | 5 +++++
       src/hotspot/share/runtime/safepoint.cpp | 3 ++-
       2 files changed, 7 insertions(+), 1 deletion(-)

      diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
      index 6006063421e..05ff1228050 100644
      --- a/src/hotspot/share/runtime/globals.hpp
      +++ b/src/hotspot/share/runtime/globals.hpp
      @@ -426,6 +426,11 @@ const int ObjectAlignmentInBytes = 8;
         product(bool, AbortVMOnSafepointTimeout, false, DIAGNOSTIC, \
                 "Abort upon failure to reach safepoint (see SafepointTimeout)") \
                                                                                   \
      + product(uint64_t, AbortVMOnSafepointTimeoutDelay, 0, DIAGNOSTIC, \
      + "Enable option AbortVMOnSafepointTimeout after this many " \
      + "milliseconds since JVM startup") \
      + range(0, max_jlong) \
      + \
         product(bool, AbortVMOnVMOperationTimeout, false, DIAGNOSTIC, \
                 "Abort upon failure to complete VM operation promptly") \
                                                                                   \
      diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp
      index 2ff593a0143..42d41f74d5d 100644
      --- a/src/hotspot/share/runtime/safepoint.cpp
      +++ b/src/hotspot/share/runtime/safepoint.cpp
      @@ -67,6 +67,7 @@
       #include "runtime/threadSMR.hpp"
       #include "runtime/threadWXSetters.inline.hpp"
       #include "runtime/timerTrace.hpp"
      +#include "services/management.hpp"
       #include "services/runtimeService.hpp"
       #include "utilities/events.hpp"
       #include "utilities/macros.hpp"
      @@ -784,7 +785,7 @@ void SafepointSynchronize::print_safepoint_timeout() {
       
         // To debug the long safepoint, specify both AbortVMOnSafepointTimeout &
         // ShowMessageBoxOnError.
      - if (AbortVMOnSafepointTimeout) {
      + if (AbortVMOnSafepointTimeout && Management::ticks_to_ms(os::elapsed_counter()) > (jlong)AbortVMOnSafepointTimeoutDelay) {
           // Send the blocking thread a signal to terminate and write an error file.
           for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur_thread = jtiwh.next(); ) {
             if (cur_thread->safepoint_state()->is_running()) {
      --

      Attachments

        Issue Links

          Activity

            People

              pchilanomate Patricio Chilano Mateo
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: