From 414eb6bb83d092fbcd87d5ab72519b6eb109837f Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Tue, 17 Dec 2024 19:06:07 +0000 Subject: [PATCH] 8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual Reviewed-by: sspitsyn, dholmes --- test/hotspot/jtreg/ProblemList-Virtual.txt | 13 ++----------- .../vmTestbase/nsk/jdb/kill/kill001/kill001a.java | 12 ++++++++++++ .../jtreg/vmTestbase/nsk/share/jdb/Launcher.java | 3 +++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList-Virtual.txt b/test/hotspot/jtreg/ProblemList-Virtual.txt index 24a1d0c7c5b..09f79165980 100644 --- a/test/hotspot/jtreg/ProblemList-Virtual.txt +++ b/test/hotspot/jtreg/ProblemList-Virtual.txt @@ -87,19 +87,10 @@ vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002/TestDescription.java vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java 8285417 generic-all ### -# The test first suspends a vthread and all the carriers and then it resumes the vthread expecting it -# to run to completion. In mainline it only works because the suspension step happens while the vthread is -# pinned to the carrier blocked on synchronized. So the carrier only actually suspends on the next unmount -# transition which in this test happens once the vthread has finished executing the expected code. - +# Fails because resume of a virtual thread is not enough to allow the virtual thread +# to make progress when all other threads are currently suspended. vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java 8338713 generic-all -### -# The test sends a StopThread to a vthread expecting that is currently pinned to the carrier blocked on -# synchronized. Since the vthread is now unmounted StopThread returns JVMTI_ERROR_OPAQUE_FRAME error. - -vmTestbase/nsk/jdb/kill/kill001/kill001.java 8338714 generic-all - ### # Fails on Windows because of additional memory allocation. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java index 37102111a93..a9adab65dd8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java @@ -27,6 +27,7 @@ import nsk.share.jpda.*; import nsk.share.jdb.*; import nsk.share.jdi.JDIThreadFactory; +import jdk.test.lib.thread.VThreadPinner; import java.io.*; import java.util.*; @@ -152,6 +153,17 @@ void methodForException() { } public void run() { + boolean vthreadMode = "Virtual".equals(System.getProperty("test.thread.factory")); + if (vthreadMode) { + // JVMTI StopThread is only supported for mounted virtual threads. We need to + // pin the virtual threads so they remain mounted. + VThreadPinner.runPinned(() -> test()); + } else { + test(); + } + } + + public void test() { // Concatenate strings in advance to avoid lambda calculations later String ThreadFinished = "Thread finished: " + this.name; String CaughtExpected = "Thread " + this.name + " caught expected async exception: " + expectedException; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java index d4437413495..44e476d0be7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java @@ -137,6 +137,9 @@ private String[] makeJdbCmdLine (String classToExecute) { /* Some tests need more carrier threads than the default provided. */ args.add("-R-Djdk.virtualThreadScheduler.parallelism=15"); } + /* Some jdb tests need java.library.path setup for native libraries. */ + String libpath = System.getProperty("java.library.path"); + args.add("-R-Djava.library.path=" + libpath); } args.addAll(argumentHandler.enwrapJavaOptions(argumentHandler.getJavaOptions()));