Summary
Remove ObjectMonitor performance counters, exposed in sun.rt._sync*
namespace.
Problem
There is a bunch of ObjectMonitor performance counters:
PerfCounter * ObjectMonitor::_sync_ContendedLockAttempts = nullptr;
PerfCounter * ObjectMonitor::_sync_FutileWakeups = nullptr;
PerfCounter * ObjectMonitor::_sync_Parks = nullptr;
PerfCounter * ObjectMonitor::_sync_Notifications = nullptr;
PerfCounter * ObjectMonitor::_sync_Inflations = nullptr;
PerfCounter * ObjectMonitor::_sync_Deflations = nullptr;
PerfLongVariable * ObjectMonitor::_sync_MonExtant = nullptr;
They seem to be seldom used, and their continued maintenance comes with at least two problems, both of which come down to intrinsic race against VM shutdown, see JDK-8049304 and JDK-8348402. Additionally, these get updated on locking paths, and attempts to do extra things, including synchronization, might obscure some of the bugs.
Some of these counters are covered by related JFR events:
_sync_ContendedLockAttempts
: covered by existingJavaMonitorEnter
event_sync_FutileWakeups
: not covered, we think this is unnecessary to track_sync_Parks
: covered by existingJavaMonitorWait
event_sync_Notifications
: covered by newJavaMonitorNotify
event (JDK-8351187)_sync_Inflations
: covered by existingJavaMonitorInflate
event_sync_Deflations
: covered by newJavaMonitorDeflate
event (JDK-8351142)_sync_MonExtant
: covered by newJavaMonitorStatistics
event (JDK-8351142)
These counters are also accessible through internal APIs or jcmd:
% jcmd 8090 PerfCounter.print | grep _sync
sun.rt._sync_ContendedLockAttempts=10045275
sun.rt._sync_Deflations=222972
sun.rt._sync_FutileWakeups=4184363
sun.rt._sync_Inflations=222991
sun.rt._sync_MonExtant=7
sun.rt._sync_Notifications=1521211
sun.rt._sync_Parks=7667155
Solution
The solution is to remove these counters.
Specification
All counters in sun.rt._sync*
would be gone, see related PR:
https://github.com/openjdk/jdk/pull/23326
- csr of
-
JDK-8348829 Remove ObjectMonitor perf counters
-
- Open
-
- relates to
-
JDK-8351142 Add JFR monitor deflation and statistics events
-
- Resolved
-
-
JDK-8351146 JFR: JavaMonitorInflate event should default to no threshold and be disabled
-
- Resolved
-
-
JDK-8351187 Add JFR monitor notification event
-
- Resolved
-