[jdk19] RFR: 8287847: Fatal Error when suspending virtual thread after it has terminated [v7]

Chris Plummer cjplummer at openjdk.org
Fri Jul 1 21:02:40 UTC 2022


On Fri, 1 Jul 2022 18:17:35 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> This fixes a bug in the debug agent when there is a request to suspend a virtual thread that has already terminated. The issue was that unless the debug agent was currently under a "suspend all", it would not properly put the virtual thread on the `otherThreads` list, and instead added it to `runningVThreads`. This meant at the end of `insertThread()` the following code tried to do a JVMTI `SetThreadLocalStorage`, which can't be done on a terminated thread.
>> 
>> 
>>         if (list != &otherThreads) {
>>             setThreadLocalStorage(node->thread, (void*)node);
>>         }
>
> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   provide a slightly more descriptive @summary

I decided to check the status of the target thread when the breakpoint was reached, and as expected it was incorrect in the virtual thread case due to [JDK-8288703](https://bugs.openjdk.org/browse/JDK-8288703). The status was THREAD_STATUS_UNKNOWN instead of THREAD_STATUS_ZOMBIE. I applied Serguei's JVMTI fix and that resolved the problem. Once Serguei pushes #102 I'll merge, verify my test changes, and then commit them for further review.

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

PR: https://git.openjdk.org/jdk19/pull/88


More information about the serviceability-dev mailing list