RFR: 8373723: Deadlock with JvmtiTagMap::flush_object_free_events()
Leonid Mesnik
lmesnik at openjdk.org
Tue Dec 16 21:46:53 UTC 2025
On Tue, 16 Dec 2025 03:57:29 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> The JvmtiTagMap::flush_object_free_events() method might be called from different threads.
>> The thread waits using lock until other thread posting events. The locking thread is in vm state doesn't allowing safepoints. While other thread posting events might request safepoints.
>>
>> The fix is to block thread to allow safepoints while waiting on the lock.
>
> src/hotspot/share/prims/jvmtiTagMap.cpp line 1210:
>
>> 1208: // This another thread might have safepoints during event callbacks.
>> 1209: ThreadBlockInVM tbivm(JavaThread::current());
>> 1210: MonitorLocker ml(lock(), Mutex::_no_safepoint_check_flag);
>
> Why not just remove the "no safepoint check" from the MonitorLocker?
This is lock is used in different places, including
`JvmtiTagMap::check_hashmaps_for_heapwalk`
which is called from VMThread.
Thus JvmtiTagMap_lock can't has rank `safepoint` and this `MonitorLocker` should also has `_no_safepoint_check_flag`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28839#discussion_r2624844825
More information about the serviceability-dev
mailing list