RFR: 8319935: Ensure only one JvmtiThreadState is create for one JavaThread associated with attached native thread [v3]
Jiangli Zhou
jiangli at openjdk.org
Wed Nov 22 22:40:25 UTC 2023
On Tue, 21 Nov 2023 23:32:13 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add a check for a thread is_attaching_via_jni, based on David Holmes' comment.
>
> src/hotspot/share/prims/jvmtiThreadState.inline.hpp line 100:
>
>> 98: assert(state->get_thread_oop() != nullptr, "incomplete state");
>> 99: }
>> 100: #endif
>
> Nit: I would suggest to write this assert in the form:
>
> // Make sure we don't see an incomplete state. An incomplete state can cause
> // a duplicate JvmtiThreadState being created below and bound to the 'thread'
> // incorrectly, which leads to stale JavaThread* from the JvmtiThreadState
> // after the thread exits.
> assert(state == nullptr || state->get_thread_oop() != nullptr, "incomplete state");
>
> The `#ifdef ASSERT` and `#endif` are not needed then.
Changed as suggested.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16642#discussion_r1402771379
More information about the serviceability-dev
mailing list