RFR: 8339725: Concurrent GC crashed due to GetMethodDeclaringClass [v5]

Erik Österlund eosterlund at openjdk.org
Tue Sep 10 21:51:06 UTC 2024


On Tue, 10 Sep 2024 10:15:43 GMT, Liang Mao <lmao at openjdk.org> wrote:

>> Hi,
>> 
>> It's a fix for 8339725. I think getting the oop from Klass::java_mirror() should use a ON_PHANTOM_OOP_REF decorator here which could make sure the oop would be kept alive in concurrent marking and return nullptr while in concurrent reference processing and unloading.
>> 
>> test/hotspot/jtreg/runtime and gc are clean.
>> 
>> Thanks,
>> Liang
>
> Liang Mao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Exclude libagent8339725.cpp compiling for windows

Some minor chages...

src/hotspot/share/prims/jvmtiEnv.cpp line 3218:

> 3216:   Handle holder(Thread::current(), k->klass_holder()); // keep the klass alive
> 3217:   // Cannot check klass_holder == nullptr because klass could have null loader holder
> 3218:   (*declaring_class_ptr) = k->is_loader_alive() ? get_jni_class_non_null(k) : nullptr;

This condition is already checked by the caller, so the !k->is_loader_alive() case should be dead code. I would prefer an assert to check that surely it is alive or we shouldn't be here.

-------------

Changes requested by eosterlund (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20907#pullrequestreview-2293838889
PR Review Comment: https://git.openjdk.org/jdk/pull/20907#discussion_r1752765549


More information about the hotspot-dev mailing list