RFR: 8334215: serviceability/dcmd/thread/PrintMountedVirtualThread.java failing with JTREG_TEST_THREAD_FACTORY=Virtual [v2]
    Inigo Mediavilla Saiz 
    duke at openjdk.org
       
    Mon Jun 17 13:28:14 UTC 2024
    
    
  
On Mon, 17 Jun 2024 13:00:11 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> test/hotspot/jtreg/serviceability/dcmd/thread/PrintMountedVirtualThread.java line 43:
>> 
>>> 41:     public void run(CommandExecutor executor) throws InterruptedException {
>>> 42:         var shouldFinish = new AtomicBoolean(false);
>>> 43:         var started = new AtomicBoolean();
>> 
>> Not sure how this change make things better? Why would we want to sleep and poll rather than park until signalled?
>
> `started.countDown()` is replaced with `started.set(true)` to remove the possibility that "Dummy Vthread" unmounts here.
@AlanBateman explained to me why that is possible in https://github.com/openjdk/jdk/pull/19482#issuecomment-2166116062 and https://github.com/openjdk/jdk/pull/19482#issuecomment-2167374446. 
Alan can correct me if I'm wrong, but I think that the dummy thread trying to unpark the main (virtual) thread needs to run as the carrier to avoid nested parking. See: https://github.com/openjdk/jdk/blob/412e306d81209c05f55aee7663f7abb80286e361/src/java.base/share/classes/java/lang/VirtualThread.java#L707
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19744#discussion_r1642814467
    
    
More information about the serviceability-dev
mailing list