On Thu, 2 May 2024 21:02:17 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> src/jdk.jdwp.agent/share/native/libjdwp/util.c line 1231: >> >>> 1229: } >>> 1230: >>> 1231: dbg_monitor->monitor = NULL; >> >> I think it would be better to protect this with dbgRawMonitor > > I don't see how that helps. Access to the field is not protected. I guess there could be a race if one thread is destroying this monitor while another is trying to use it. Thus a thread could be doing something like a RawMonitorEnter in the middle of (or after) the monitor being destroyed. Fixing that would require holding dbgRawMonitor during RawMonitorEnter, and that would cause deadlocks all over the place. Also, this same potential issue exists already, but doesn't seem to ever arise. It seems we only call debugMonitorDestroy for cmdQueueLock. Not sure why that is. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19044#discussion_r1591586968