RFR: 8281615: Deadlock caused by jdwp agent [v2]
Zhengyu Gu
zgu at openjdk.java.net
Tue Feb 15 17:48:44 UTC 2022
On Tue, 15 Feb 2022 06:36:36 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c line 100:
>>
>>> 98: struct bag* deleted = deletedSignatures;
>>> 99: deletedSignatures = NULL;
>>> 100: debugMonitorExit(classTrackLock);
>>
>> This looks risky as the critical section is broken and the NULL deleted signatures exposed. If `cbTrackingObjectFree` occurs while this is true then you will lose the record of the deleted signature.
>>
>> Alternatively you could allow for lock-free reading of `deletedSignatures`, preemptively allocate a new bad if needed then take the lock. Or even use the lock to read `deletedSignatures` to determine if a new bag is needed, then drop the lock, create the bag, take the lock and re-check everything.
>
> Agreed.
Fixed
-------------
PR: https://git.openjdk.java.net/jdk/pull/7461
More information about the serviceability-dev
mailing list