RFR: 8256314: JVM TI GetCurrentContendedMonitor is implemented incorrectly

Serguei Spitsyn sspitsyn at openjdk.org
Wed Feb 21 10:36:05 UTC 2024


The implementation of the JVM TI `GetCurrentContendedMonitor` does not match the spec. It can sometimes return an incorrect information about the contended monitor. Such a behavior does not match the function spec. 
With this update the `GetCurrentContendedMonitor` is returning the monitor only when the specified thread is waiting to enter or re-enter the monitor, and the monitor is not returned when the specified thread is waiting in the `java.lang.Object.wait` to be notified.

The implementation of the JDWP `ThreadReference.CurrentContendedMonitor` command is based and depends on this JVMTI function. The command was both specified incorrectly and had an incorrect behavior. The fix slightly corrects the JDWP spec to make it right (the JDWP implementation has been fixed by the JVM TI update). Please, see and review the related CSR and Release-Note.

CSR: [8326024](https://bugs.openjdk.org/browse/JDK-8326024): JVM TI GetCurrentContendedMonitor is implemented incorrectly
RN:   [8326038](https://bugs.openjdk.org/browse/JDK-8326038): Release Note: JVM TI GetCurrentContendedMonitor is implemented incorrectly

Testing:
 - tested with the mach5 tiers 1-6

-------------

Commit messages:
 - 8256314: JVM TI GetCurrentContendedMonitor is implemented incorrectly

Changes: https://git.openjdk.org/jdk/pull/17944/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17944&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8256314
  Stats: 46 lines in 5 files changed: 27 ins; 10 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/17944.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17944/head:pull/17944

PR: https://git.openjdk.org/jdk/pull/17944


More information about the core-libs-dev mailing list