Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8247972 incorrect implementation of JVM TI GetObjectMonitorUsage
  3. JDK-8325314

Release Note: The Implementation of JVMTI `GetObjectMonitorUsage` Has Been Corrected

XMLWordPrintable

      The JVMTI `GetObjectMonitorUsage` function returns the following data structure:
      ```
          typedef struct {
              jthread owner;
              jint entry_count;
              jint waiter_count;
              jthread* waiters;
              jint notify_waiter_count;
              jthread* notify_waiters;
          } jvmtiMonitorUsage;
      ```

      Two fields in this structure are specified as:
      - `waiter_count` [`jint`]: The number of threads waiting to own this monitor
      - `waiters` [`jthread*`]: The `waiter_count` waiting threads

      In previous releases, the `waiters` field included the threads waiting to enter or re-enter the monitor as specified, but also (incorrectly) the threads waiting to be notified in `java.lang.Object.wait()`. That has been fixed in the current release. The `waiter_count` always matches the returned number of threads in the `waiters` field.

      Also, the JDWP `ObjectReference.MonitorInfo` command spec was updated to clarify what the `waiters` threads are:
      > `waiters`: "The total number of threads that are waiting to enter or re-enter the monitor, or waiting to be notified by the monitor."

      The behavior of this JDWP command is kept the same, and is intentionally different to `GetObjectMonitorUsage`.

            sspitsyn Serguei Spitsyn
            sspitsyn Serguei Spitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: