On Wed, 4 Jan 2023 04:54:27 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> Serguei Spitsyn has updated the pull request incrementally with one >> additional commit since the last revision: >> >> fix race between VTMS_transition_disable_for_one and start_VTMS_transition > > src/hotspot/share/prims/jvmtiThreadState.cpp line 482: > >> 480: _VTMS_transition_disable_for_all_count > 0) { >> 481: MonitorLocker ml(JvmtiVTMSTransition_lock, >> Mutex::_no_safepoint_check_flag); >> 482: ml.notify_all(); > > Checking the counts outside the lock seems really racy. Maybe it is safe in > the original code but now we have two counters it is very hard to ascertain > this is correct. Overall I find it very hard to see exactly how these > counters get used. This notification code is just an optimization. All related waiting fragments are with timeouts. I agree this sync protocol is kind of complicated and also does not scale well. I'm still thinking on how to improve it. ------------- PR: https://git.openjdk.org/jdk/pull/11690