RFR: 8257831: Suspend with handshakes [v2]

Robbin Ehn rehn at openjdk.java.net
Wed Apr 7 08:06:59 UTC 2021


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.

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

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


More information about the serviceability-dev mailing list