RFR: 8321069: JvmtiThreadState::state_for_while_locked() returns nullptr for an attached JNI thread with a java.lang.Thread object after JDK-8319935 [v2]

Daniel D. Daugherty dcubed at openjdk.org
Mon Dec 4 18:16:55 UTC 2023


On Mon, 4 Dec 2023 06:31:43 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   dholmes CR - adjust a comment.
>
> Initially I thought this was not the right fix as we should not be exposing an attaching thread that may still have a partially constructed `threadObj`. But this issue shows that we must expose such a thread because the constructor of the `Thread` object can trigger these events on the current thread so it must have a valid JVMTI state!
> 
> Thanks.

@dholmes-ora - Thanks for the review.

> src/hotspot/share/prims/jvmtiThreadState.inline.hpp line 90:
> 
>> 88:     // Don't add a JvmtiThreadState to a thread that is exiting or is attaching.
>> 89:     // When a thread is attaching, it may not have a Java level thread object
>> 90:     // created yet.
> 
> The comment needs adjusting now - suggestion:
> 
> // Don't add a JvmtiThreadState to a thread that is exiting, or is attaching
> // and does not yet have a Java level thread object allocated.

Thanks for the suggested change. I agree and I've applied it.

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

PR Comment: https://git.openjdk.org/jdk/pull/16934#issuecomment-1839205636
PR Review Comment: https://git.openjdk.org/jdk/pull/16934#discussion_r1414306493


More information about the serviceability-dev mailing list