Skip to content

Commit

Permalink
8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTRE…
Browse files Browse the repository at this point in the history
…G_TEST_THREAD_FACTORY=Virtual

Reviewed-by: dholmes
Backport-of: 414eb6b
  • Loading branch information
SendaoYan committed Dec 19, 2024
1 parent b8249c5 commit 4aec2d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 2 additions & 11 deletions test/hotspot/jtreg/ProblemList-Virtual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 12 additions & 0 deletions test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down

0 comments on commit 4aec2d4

Please sign in to comment.