On Mon, 14 Feb 2022 23:26:17 GMT, David Holmes <[email protected]> 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