With help of the D-Light tool I can see that the contended-exit events
comes after contended-entered event on another thread.
This is an example:
t12:Enter, t14:Enter, t2:Exit, t14:Entered, (t14:Exit is missed), t12:Entered
The tool does not show the t14:Exit event as it is already out of scope.
It happens because the Hotspot monitor-contended-exit probe is located incorrectly.
I think that posting the contended__exit monitor probe needs to be done
before wakee is unparked:
void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) {
...
Trigger->unpark() ;
// Maintain stats and report events to JVMTI
if (ObjectSynchronizer::_sync_Parks != NULL) {
ObjectSynchronizer::_sync_Parks->inc() ;
}
DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
}