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

Serguei Spitsyn sspitsyn at openjdk.org
Sat Jul 2 05:43:42 UTC 2022


On Sat, 2 Jul 2022 05:23:04 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> test/jdk/com/sun/jdi/TestScaffold.java line 976:
>> 
>>> 974:                 }
>>> 975:             });
>>> 976:             Thread.currentThread().setName(OLD_MAIN_THREAD_NAME);
>> 
>> Just want to understand what is this thread naming is about.
>> Is it just to properly name the threads, or there is some other reason for this?
>> Also, why OLD_MAIN_THREAD_NAME is a little bit strange and why old?
>
> The "main" debuggee thread is always launched as a platform thread. There's no choice in that since it is simply the main application thread. When using the virtual thread wrapper, the "main" thread will spawn a virtual thread to run the debuggee on. By default virtual threads have no name. For the nsk debugger tests, "main" was renamed to "old-m-a-i-n", and the new debuggee virtual thread named "main". For some reason that was never done for the com/sun/jdi tests. I only made this change because in `breakpointReached()` of the test it prints out the thread, and I noticed the name was empty.  I could leave this change out if you want and file a separate CR for it. The test should still run ok without it.

Thank you for explaining. Just wanted to understand the motivation.

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

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


More information about the serviceability-dev mailing list