RFR: 8277444: Race condition on Instrumentation.retransformClasses() and class linking [v2]

Evgeny Astigeevich eastigeevich at openjdk.org
Tue Aug 26 13:39:14 UTC 2025


On Mon, 25 Aug 2025 20:23:52 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add missing include runtime/synchronizer.hpp
>
> src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp line 1004:
> 
>> 1002:   // is_rewritten() returns false. So we won't restore the original bytecodes.
>> 1003:   // We hold a lock to guarantee we are not getting bytecodes
>> 1004:   // at the same time the linking process are rewriting them.
> 
> Suggestion:
> 
>   // We acquire the init_lock monitor to serialize with class linking so we are not getting 
>   // bytecodes at the same time the linking process is rewriting them.

Done

> src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp line 1006:
> 
>> 1004:   // at the same time the linking process are rewriting them.
>> 1005:   Handle h_init_lock(Thread::current(), mh->method_holder()->init_lock());
>> 1006:   ObjectLocker ol(h_init_lock, JavaThread::current());
> 
> Suggestion:
> 
>   JavaThread* current = JavaThread::current();
>   Handle h_init_lock(current, mh->method_holder()->init_lock());
>   ObjectLocker ol(h_init_lock, current);

Done

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2301024352
PR Review Comment: https://git.openjdk.org/jdk/pull/26863#discussion_r2301023827


More information about the hotspot-dev mailing list