RFR: 8281615: Deadlock caused by jdwp agent [v2]
Zhengyu Gu
zgu at openjdk.java.net
Tue Feb 15 17:56:12 UTC 2022
On Mon, 14 Feb 2022 23:26:17 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:
>>
>> David and Chris' comments
>
> src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c line 215:
>
>> 213: classTrack_activate(JNIEnv *env)
>> 214: {
>> 215: struct bag* new_bag = bagCreateBag(sizeof(char*), 1000);
>
> I don't think there can be any race during activation but this change is harmless.
I am not sure classTrack_activate() has the problem, but it is called outside of initialization, inside debug loop ... so I assume that event callback might happen.
> src/jdk.jdwp.agent/share/native/libjdwp/classTrack.c line 240:
>
>> 238: if (deletedSignatures != NULL) {
>> 239: bagEnumerateOver(deletedSignatures, cleanDeleted, NULL);
>> 240: to_delete = deletedSignatures;
>
> `cleanDeleted` also calls `jvmtiDeallocate`, so either both need to be outside the lock or neither.
>
> It is really unclear to me how many threads can be involved here and which functions can be called when.
Right. Moved `bagEnumerateOver()` outside of lock as well.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7461
More information about the serviceability-dev
mailing list