RFR: 8349689: Several virtual thread tests missing /native keyword

SendaoYan syan at openjdk.org
Tue Feb 11 08:47:11 UTC 2025


On Tue, 11 Feb 2025 07:30:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Can you check if these two needs to be updated too?
> 
> test/jdk/java/lang/Thread/virtual/ThreadPollOnYield.java test/jdk/java/lang/Thread/virtual/Starvation.java

These two tests also need `/native` keyword.

- Test test/jdk/java/lang/Thread/virtual/ThreadPollOnYield.java do not report test failed or error when missing load the native shared libary. So I add a check to make sure that the first virtual of this test run normally.

The original test output from jfr file shows below:


STARTED    ThreadPollOnYield::testThreadYieldPolls 'testThreadYieldPolls()'
Exception in thread "" java.lang.ExceptionInInitializerError
    at ThreadPollOnYield.lambda$testThreadYieldPolls$0(ThreadPollOnYield.java:59)
    at java.base/java.lang.VirtualThread.run(VirtualThread.java:466)
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot open library: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib/libVThreadPinner.so
    at jdk.test.lib.thread.VThreadPinner.invoker(VThreadPinner.java:135)
    at jdk.test.lib.thread.VThreadPinner.<clinit>(VThreadPinner.java:50)
    ... 2 more
Caused by: java.lang.IllegalArgumentException: Cannot open library: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib/libVThreadPinner.so
    at java.base/java.lang.foreign.SymbolLookup.libraryLookup(SymbolLookup.java:350)
    at java.base/java.lang.foreign.SymbolLookup.libraryLookup(SymbolLookup.java:335)
    at jdk.test.lib.thread.VThreadPinner.invoker(VThreadPinner.java:130)
    ... 3 more
Exception in thread "" java.lang.NoClassDefFoundError: Could not initialize class jdk.test.lib.thread.VThreadPinner
    at ThreadPollOnYield.lambda$testThreadYieldPolls$2(ThreadPollOnYield.java:69)
    at java.base/java.lang.VirtualThread.run(VirtualThread.java:466)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot open library: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib/libVThreadPinner.so [in thread "ForkJoinPool-1-worker-1"]
    at jdk.test.lib.thread.VThreadPinner.invoker(VThreadPinner.java:135)
    at jdk.test.lib.thread.VThreadPinner.<clinit>(VThreadPinner.java:50)
    at ThreadPollOnYield.lambda$testThreadYieldPolls$0(ThreadPollOnYield.java:59)
    ... 1 more
SUCCESSFUL ThreadPollOnYield::testThreadYieldPolls 'testThreadYieldPolls()'



- Test test/jdk/java/lang/Thread/virtual/Starvation.java execute over 120 seconds on my local environment. So I add `timeout=200` also.


elapsed time (seconds): 121.41

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

PR Comment: https://git.openjdk.org/jdk/pull/23550#issuecomment-2650141187


More information about the core-libs-dev mailing list