On Wed, 17 Nov 2021 22:21:33 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
> The test fails when the target JavaThread has is_exiting() status. In such a > case the JvmtiExport::cleanup_thread(this) has already made a clean up of its > jvmtiThreadState, so the JavaThread address returned by _state->get_thread() > is 0xbabababababababa. > The fix is to add a check for is_exiting() status into handshake closure > do_thread() early. > There following handshake closures are fixed by this update: > - UpdateForPopTopFrameClosure > - SetForceEarlyReturn > - SetFramePopClosure Hi David, Thank you for reviewing this! I was also thinking about getting rid of the check `java_thread->threadObj() == NULL`. Then I've decided it is safe to keep it as it was in the original UpdateForPopTopFrameClosure implementation (but later in the code). I will remove it and retest the fix. > Second, if the target thread is exiting then surely the suspension check > should return > false and so we would already give a JVMTI_ERROR_THREAD_NOT_SUSPENDED error? The assert ` assert(java_thread == _state->get_thread(), "Must be");` is fired one line before the `JVMTI_ERROR_THREAD_NOT_SUSPENDED` code is returned. ------------- PR: https://git.openjdk.java.net/jdk/pull/6440