RFR: 8373723: Deadlock with JvmtiTagMap::flush_object_free_events()

David Holmes dholmes at openjdk.org
Tue Dec 16 04:01:00 UTC 2025


On Tue, 16 Dec 2025 03:34:47 GMT, Leonid Mesnik <lmesnik 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 1208:

> 1206:     {
> 1207:       // If another thread is posting events, let it finish.
> 1208:       // This another thread might have safepoints during event callbacks.

The comment does not read correctly.

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?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28839#discussion_r2621667991
PR Review Comment: https://git.openjdk.org/jdk/pull/28839#discussion_r2621668730


More information about the serviceability-dev mailing list