RFR: 8318631: GetStackTraceSuspendedStressTest.java failed with: check_jvmti_status: JVMTI function returned error: JVMTI_ERROR_THREAD_NOT_ALIVE (15)
Serguei Spitsyn
sspitsyn at openjdk.org
Mon Nov 6 20:16:29 UTC 2023
On Mon, 6 Nov 2023 20:04:44 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:
>> Is the issue here that agent thread started by Debuggee.checkStatus is racing with the test? The producer/consumer thread do 1000 put/take ops and it looks like it can complete and VM commence shutdown while the agent thread is observing, do I read this correctly?
>
> Thank you for the comments.
> Alex, you are right.
> I've misread this code at line 201:
>
> 199 err = jvmti->SuspendThread(vthread);
> 200 if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
> 201 continue;
> 202 }
> 203 check_jvmti_status(jni, err, "Error in SuspendThread");
> 204 // LOG("Agent: suspended vt: %s ct: %s\n", vname, cname);
> 205
> 206 check_vthread_consistency_suspended(jvmti, jni, vthread);
>
> The function `check_vthread_consistency_suspended()` is not called when if the `SuspendThread` returned `JVMTI_ERROR_THREAD_NOT_ALIVE` error code.
>
> It does not look as a test bug then.
David and Alan,
Yes, there is always a race between the app and the JVMTI agent execution. This was always a general issue with the JVMTI. The agent code executing JVMTI functions and events is not protected from the `JVMTI_ERROR_WRONG_PHASE` errors. This error code can be returned by JVMTI functions even in the middle of the event callback execution. We had this problem in the JDWP agent and fixed it by adding proper synchronization into the agent itself.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16488#discussion_r1383923778
More information about the serviceability-dev
mailing list