RFR: 8319935: Ensure only one JvmtiThreadState is create for one JavaThread associated with attached native thread [v2]

Jiangli Zhou jiangli at openjdk.org
Mon Nov 20 19:28:17 UTC 2023


On Thu, 16 Nov 2023 09:48:48 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Don't try to setup_jvmti_thread_state for obj allocation sampling if the current thread is attaching from native and is allocating the thread oop. That's to make sure we don't create a 'partial' JvmtiThreadState.
>
> src/hotspot/share/prims/jvmtiThreadState.inline.hpp line 87:
> 
>> 85:     // Don't add a JvmtiThreadState to a thread that is exiting.
>> 86:     return nullptr;
>> 87:   }
> 
> I'm wondering if there should also be an `is_jni_attaching` check here?

That seems to be a good idea. It would cover other cases that we haven't seen yet. Added a check as suggested, thanks.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16642#discussion_r1399647867


More information about the serviceability-dev mailing list