RFR: 8257831: Suspend with handshakes [v2]

David Holmes david.holmes at oracle.com
Wed Apr 7 09:45:41 UTC 2021


On 7/04/2021 6:06 pm, Robbin Ehn wrote:
> On Wed, 7 Apr 2021 07:04:50 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> 
>>> I'm also unclear what Robbin is referring to. I go back to my original comment that surely JVMTI_ERROR_THREAD_NOT_ALIVE is impossible here?
>>
>> We do a callback with a terminated thread, if the thread then in the agent tries to suspend itself we should return JVMTI_ERROR_THREAD_NOT_ALIVE.
> 
> "How can you do a callback on a terminated thread here? The thread should
> only respond to the suspend request before it reaches the point in its
> exit where it would report "not alive"."
> 
> We need to keep the threadObj while we are not terminated.
> When terminated we need to clear threadObj and notify any waiters.
> ObjectLocker executes OM::enter(), on contention OM::enter() do a callback to your agent.
> If you on that callback execute suspendThreadList(), the correct return value for:
> `"JvmtiSuspendControl::suspend(current)"` would be JVMTI_ERROR_THREAD_NOT_ALIVE, since JavaThread::is_exiting() would return true here.

Sorry yes I see what you mean.

Thanks,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/3191
> 


More information about the serviceability-dev mailing list