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

JFR: JavaMonitorDeflateEvent crashes when deflated monitor object is dead

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 25
    • hotspot
    • None
    • jfr
    • b16

      The jdk/jfr/event/runtime/TestJavaMonitorDeflateEvent.java sigsegvs with the following error:

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # SIGSEGV (0xb) at pc=0x00007f9b7dbd0bda, pid=3080857, tid=3080883
      #
      # JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-internal-LTS-2025-03-18-1052460.thomas.schatzl.jdk)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-internal-LTS-2025-03-18-1052460.thomas.schatzl.jdk, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x60dbda] oopDesc::klass() const+0x5a
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to [...])
      #
      # JFR recording file will be written. Location:

      [...]

      Current thread (0x00007f9b781fdbc0): JavaThread "Monitor Deflation Thread" daemon [_thread_in_vm, id=3080883, stack(0x00007f9b5c196000,0x00007f9b5c296000) (1024K)]

      Stack: [0x00007f9b5c196000,0x00007f9b5c296000], sp=0x00007f9b5c294930, free space=1018k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x60dbda] oopDesc::klass() const+0x5a (oop.inline.hpp:103)
      V [libjvm.so+0x15d40a6] ObjectMonitor::deflate_monitor(Thread*)+0x436 (objectMonitor.cpp:740)
      V [libjvm.so+0x1903785] ObjectSynchronizer::deflate_monitor_list(ObjectMonitorDeflationSafepointer*)+0xb5 (synchronizer.cpp:1669)
      V [libjvm.so+0x1904d12] ObjectSynchronizer::deflate_idle_monitors()+0x1d2 (synchronizer.cpp:1828)
      V [libjvm.so+0x155c325] MonitorDeflationThread::monitor_deflation_thread_entry(JavaThread*, JavaThread*)+0x1c5 (monitorDeflationThread.cpp:91)
      V [libjvm.so+0xf92aef] JavaThread::thread_main_inner()+0x12f (javaThread.cpp:776)
      V [libjvm.so+0x1972626] Thread::call_run()+0xb6 (thread.cpp:231)
      V [libjvm.so+0x161a9a8] thread_native_entry(Thread*)+0x128 (os_linux.cpp:877)

      siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000008

      It looks like that the call to post_monitor_deflate_event() in ObjectMonitor::deflate_monitor() does not check whether the given obj is null or not, and just tries to dereference it.

            shade Aleksey Shipilev
            tschatzl Thomas Schatzl
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: