Skip to content

Commit 414eb6b

Browse files
committedDec 17, 2024
8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual
Reviewed-by: sspitsyn, dholmes
1 parent dc71e8c commit 414eb6b

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed
 

‎test/hotspot/jtreg/ProblemList-Virtual.txt

+2-11
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,10 @@ vmTestbase/nsk/jdi/ExceptionEvent/catchLocation/location002/TestDescription.java
8787
vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java 8285417 generic-all
8888

8989
###
90-
# The test first suspends a vthread and all the carriers and then it resumes the vthread expecting it
91-
# to run to completion. In mainline it only works because the suspension step happens while the vthread is
92-
# pinned to the carrier blocked on synchronized. So the carrier only actually suspends on the next unmount
93-
# transition which in this test happens once the vthread has finished executing the expected code.
94-
90+
# Fails because resume of a virtual thread is not enough to allow the virtual thread
91+
# to make progress when all other threads are currently suspended.
9592
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java 8338713 generic-all
9693

97-
###
98-
# The test sends a StopThread to a vthread expecting that is currently pinned to the carrier blocked on
99-
# synchronized. Since the vthread is now unmounted StopThread returns JVMTI_ERROR_OPAQUE_FRAME error.
100-
101-
vmTestbase/nsk/jdb/kill/kill001/kill001.java 8338714 generic-all
102-
10394
###
10495
# Fails on Windows because of additional memory allocation.
10596

‎test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import nsk.share.jpda.*;
2828
import nsk.share.jdb.*;
2929
import nsk.share.jdi.JDIThreadFactory;
30+
import jdk.test.lib.thread.VThreadPinner;
3031

3132
import java.io.*;
3233
import java.util.*;
@@ -152,6 +153,17 @@ void methodForException() {
152153
}
153154

154155
public void run() {
156+
boolean vthreadMode = "Virtual".equals(System.getProperty("test.thread.factory"));
157+
if (vthreadMode) {
158+
// JVMTI StopThread is only supported for mounted virtual threads. We need to
159+
// pin the virtual threads so they remain mounted.
160+
VThreadPinner.runPinned(() -> test());
161+
} else {
162+
test();
163+
}
164+
}
165+
166+
public void test() {
155167
// Concatenate strings in advance to avoid lambda calculations later
156168
String ThreadFinished = "Thread finished: " + this.name;
157169
String CaughtExpected = "Thread " + this.name + " caught expected async exception: " + expectedException;

‎test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ private String[] makeJdbCmdLine (String classToExecute) {
137137
/* Some tests need more carrier threads than the default provided. */
138138
args.add("-R-Djdk.virtualThreadScheduler.parallelism=15");
139139
}
140+
/* Some jdb tests need java.library.path setup for native libraries. */
141+
String libpath = System.getProperty("java.library.path");
142+
args.add("-R-Djava.library.path=" + libpath);
140143
}
141144

142145
args.addAll(argumentHandler.enwrapJavaOptions(argumentHandler.getJavaOptions()));

0 commit comments

Comments
 (0)
Please sign in to comment.