JDK-8286957 : Held monitor count
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-05-18
  • Updated: 2024-01-31
  • Resolved: 2022-07-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b06Fixed
Related Reports
Relates :  
Relates :  
Description
The implementation counts high in the abstraction, which makes it needing to add counting in multiple places and some locking is not counted.

Today the missed locking count works due to we only mount continuations in controlled environment. In an uncontrolled environment it can create some issue.

Third, since the counting is not counting every held monitor it cannot be used for other purposes.

For these reason we should push down the counting near the actual locking/unlocking and make sure it is exact.
Comments
I believe the counting is correct therefore I had it always on as it serves as a good verification. I think it found a bug in EA, as the counting is a hint of visibility.
04-01-2024

This change broke escape analysis - see JDK-8322743.
03-01-2024

Changeset: ac399e97 Author: Robbin Ehn <rehn@openjdk.org> Date: 2022-07-08 07:12:19 +0000 URL: https://git.openjdk.org/jdk/commit/ac399e9777731e7a9cbc2ad3396acfa5358b1c76
08-07-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/8945 Date: 2022-05-30 11:04:11 +0000
20-06-2022