RFR: 8334215: serviceability/dcmd/thread/PrintMountedVirtualThread.java failing with JTREG_TEST_THREAD_FACTORY=Virtual [v3]

Inigo Mediavilla Saiz duke at openjdk.org
Tue Jun 18 11:51:31 UTC 2024


On Tue, 18 Jun 2024 11:41:36 GMT, Inigo Mediavilla Saiz <duke at openjdk.org> wrote:

>> Follow up to https://github.com/openjdk/jdk/pull/19482 that was causing issues when the PrintMountedVirtualTest.java was
>> running with `JTREG_TEST_THREAD_FACTORY=Virtual` in the loom repo. 
>> 
>> - Fixes issues where the test observes the thread during transitions.
>> - Fixes a potential issue in the test where CountDownLatch.countDown unparks the main (virtual) thread and the main thread observes the dummy thread is transition .
>
> Inigo Mediavilla Saiz has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Move the explanation before the if

> I looked at the changes in the latest revision ([9a954ef](https://github.com/openjdk/jdk/commit/9a954efe164d9caee31494773c0eecc8ff69223f)) and they look okay, it basically skips printing the mounted virtual thread when that virtual thread is interacting with the scheduler or timer mechanism, the so called "temporary transitions" that are needed to ensure the correct identity when submitting tasks to the scheduler, and to avoid deadlock when submitting tasks to the scheduler requires locking. It also changes the test so testing with JTREG_TEST_THREAD_FACTORY=Virtual won't observe the dummy thread in a temporary transition.
> 
> We can improve on this in the loom repo as JavaThread has the thread ID of the mounted virtual thread. Note that the pre-existing "Carrying ..." line has the same issue as we've been discussing here, it just hasn't been noticed perhaps.
> 
> One thing that I think we should do is remove the thread name from the "Mounted ..." line. I initially thought this was a good idea but there is no reference to this when a virtual thread is mounted and interacting with the scheduler. Virtual threads don't have a name by default so it's not a big a loss as you might think. We can of course re-visit this in the future.

Thanks ! I've removed the virtual thread name from the "Mounted .." line in: af85b2617c97eeb31ce347f42b019c261bc141f1

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

PR Comment: https://git.openjdk.org/jdk/pull/19744#issuecomment-2175909304


More information about the serviceability-dev mailing list