JDK-8319896 : Remove monitor deflation from final audit
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-11-10
  • Updated: 2024-03-18
  • Resolved: 2023-11-17
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 21 JDK 22
21.0.4-oracleFixed 22 b25Fixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Relates :  
Description
In JDK-8318757 we can see that running a monitor deflation pass during a safepointed operation can interleave with the async monitor deflation, which causes various problems. The fix is to stop deflating monitors in the thread dump operation and instead only collect relevant monitors.

There is yet another place where we call monitor deflation from outside of the monitor deflation thread. That place is the "final audit" part, which walks over monitors and performs verification and logging. Before the walk over the list of monitors we perform a monitor deflation pass to prune the system from "uninteresting" monitors.

I propose that we remove the monitor deflation from the final audit, and that we instead only visit "interesting" monitors (those that have an owner or "is busy"). After this change it's only the monitor deflation thread that performs monitor deflation. It is unclear to me if the final audit can actually interleave with the async monitor deflation, but this removal makes it easier to reason around monitor deflation since it is only one thread that is performing it.
Comments
[jdk21u-fix-request] Approval Request from Aleksey Shipilëv This resolves the last place that might lead to bugs due to interleaving with concurrent monitor deflation. Less important than JDK-8318757, since this only happens on JVM shutdown, but it makes relevant backports like JDK-8320515 clean. This is a part of atomic 21u integration, see 21u-dev PR for more details. Applies cleanly. All tests pass. Was in mainline for several months. Small bugtail: needs JDK-8325437 as the followup.
12-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/337 Date: 2024-03-06 19:12:00 +0000
07-03-2024

Changeset: 369bbecc Author: Stefan Karlsson <stefank@openjdk.org> Date: 2023-11-17 07:04:13 +0000 URL: https://git.openjdk.org/jdk/commit/369bbecc0dab389b523c09bc332fe1cf6394cb26
17-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/16605 Date: 2023-11-10 12:35:46 +0000
10-11-2023