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

Fix allocation bug in java_lang_Thread::async_get_stack_trace()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 20
    • 20
    • hotspot
    • b18

    Description

      The GrowableArrays created in the GetStackTraceClosure constructor to store the bci and Method* of each frame found while traversing the stack are allocated in the resource area of the thread that calls async_get_stack_trace(). But if the handshake is executed by the target and if the number of frames in the stack exceeds the initial size of the GrowableArrays then we will hit an assertion when trying to grow the size of the array.
      Example of crash when running the vmTestbase/nsk/stress/strace/ tests with a lower value of init_length or increasing DEPTH in one of those tests beyond 512:

      STDOUT:
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/growableArray.cpp:69
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/scratch/pchilano/random4/open/src/hotspot/share/utilities/growableArray.cpp:69), pid=44913, tid=45008
      # fatal error: allocation bug: GrowableArray could grow within nested ResourceMark
      #
      # JRE version: OpenJDK Runtime Environment (20.0) (fastdebug build 20-internal-2022-09-20-1654122.pchilano...)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 20-internal-2022-09-20-1654122.pchilano..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xeff27a] GrowableArrayMetadata::on_stack_alloc_check() const+0x5a
      #
      # Core dump will be written. Default location: /scratch/pchilano/random4/open/build/linux-x64/test-support/jtreg_test_hotspot_jtreg_vmTestbase_nsk_stress_strace_strace003_java/scratch/0/core.44913
      #

      The arrays should be created in the C heap instead.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: