RFR: 8334215: serviceability/dcmd/thread/PrintMountedVirtualThread.java failing with JTREG_TEST_THREAD_FACTORY=Virtual
Inigo Mediavilla Saiz
duke at openjdk.org
Mon Jun 17 13:15:13 UTC 2024
On Mon, 17 Jun 2024 12:34:25 GMT, David Holmes <dholmes 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 .
>
> src/hotspot/share/runtime/threads.cpp line 1335:
>
>> 1333: const oop vt = p->vthread();
>> 1334: if (vt != thread_oop) {
>> 1335: assert(vt != nullptr, "vthread should not be null when vthread is mounted");
>
> I think the assert still belongs in the original position doesn't it? Or could the problem we hit here cause a transient null to appear as well?
I think that, even if based on [this](https://github.com/openjdk/jdk/pull/19482#issuecomment-2166116062) comment from @AlanBateman's in some cases the virtual thread can be mounted but `_vthread` can refer to the carrier thread, what you're saying is correct and in both cases `_vthread` should still not be a null pointer:
- Either it's equal to `thread_oop` and we've already checked that it's not `nullptr`.
- Or it's different to `thread_oop` and it refers to an actual virtual thread that should not be null.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19744#discussion_r1642794256
More information about the hotspot-runtime-dev
mailing list