RFR: 8339725: Concurrent GC crashed due to GetMethodDeclaringClass [v5]
Liang Mao
lmao at openjdk.org
Wed Sep 11 03:26:05 UTC 2024
On Wed, 11 Sep 2024 02:23:10 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Liang Mao has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Exclude libagent8339725.cpp compiling for windows
>
> src/hotspot/share/prims/jvmtiEnv.cpp line 3216:
>
>> 3214: NULL_CHECK(method, JVMTI_ERROR_INVALID_METHODID);
>> 3215: Klass* k = method->method_holder();
>> 3216: Handle holder(Thread::current(), k->klass_holder()); // keep the klass alive
>
> How do we know `k` is not already unloaded?
As @fisk mentioned above, `k->is_loader_alive()` is checked in caller `jvmti_GetMethodDeclaringClass`. So we won't enter here if k is already unloaded. The exception this PR handles is to deal with the `k` in the middle of concurrent marking that `is_loader_alive` returns `true` but could be unloaded soon. We'd better keep it alive just like accessing weak reference.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20907#discussion_r1753067662
More information about the hotspot-dev
mailing list