RFR: 8357914: TestEmptyBootstrapMethodsAttr.java fails when run with TEST_THREAD_FACTORY=Virtual

Patricio Chilano Mateo pchilanomate at openjdk.org
Mon Jun 2 15:01:29 UTC 2025


On Thu, 29 May 2025 22:47:40 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java line 58:
>> 
>>> 56:         output.shouldNotContain("java.lang.ClassFormatError");
>>> 57:         output.shouldHaveExitValue(1);
>>> 58:         if (Thread.currentThread().isVirtual()) {
>> 
>> Just to be clear with `TEST_THREAD_FACTORY=Virtual` are all launched JVMs modified such that a virtual thread is created to invoke "main" instead of the normal platform thread? It just isn't clear why being virtual in the parent VM implies the child was also virtual, unless everything is virtual.
>> 
>> FWIW I think this highlights a deficiency with how TEST_THREAD_FACTORY=Virtual actually works.
>
> Yes, the the main is executed in virtual thread and also it runs all forked processes with wrapper that run main in virtual thread. 
> The another, might be more clear solution would to check it with
> `static final boolean vthreadMode = "Virtual".equals(System.getProperty("test.thread.factory"));`
> 
> or even make library method for this in the future.

Yes, this check looks a bit better. How about checking that on the child's VM args directly to avoid assumptions between parent/child?
`boolean vthreadMode = pb.command().toString().contains("test.thread.factory=Virtual");`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25509#discussion_r2121415781


More information about the hotspot-runtime-dev mailing list