Skip to content

8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual #22620

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

plummercj
Copy link
Contributor

@plummercj plummercj commented Dec 6, 2024

This test fails after JDK-8338713 when using JTREG_TEST_THREAD_FACTORY=Virtual. The test uses JVMTI StopThread on a thread expecting it to be mounted. Before JDK-8338713 it would be mounted because it was blocked on a syncrhonized, which resulted in the thread being pinned. After JDK-8338713 this is no longer the case and the virtual thread has unmounted. This causes JVMTI StopThread to fail with JVMTI_ERROR_OPAQUE_FRAME because it only supports mounted virtual threads.

Fixed by using the VThreadPinner class to make sure the virtual threads remains pinned, and therefore mounted.

Testing:

  • Ran jdb tests locally in both virtual thread mode and platform thread mode.
  • tier1
  • tier2 svc
  • tier5 svc

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22620/head:pull/22620
$ git checkout pull/22620

Update a local copy of the PR:
$ git checkout pull/22620
$ git pull https://git.openjdk.org/jdk.git pull/22620/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22620

View PR using the GUI difftool:
$ git pr show -t 22620

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22620.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 6, 2024

👋 Welcome back cjplummer! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 6, 2024

@plummercj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual

Reviewed-by: sspitsyn, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 142 new commits pushed to the master branch:

  • dc71e8c: 8342995: Enhance Attach API to support arbitrary length arguments - Linux
  • 4f44cf6: 8341481: [perf] vframeStreamCommon constructor may be optimized
  • 390b205: 8346048: test/lib/containers/docker/DockerRunOptions.java uses addJavaOpts() from ctor
  • 03821d9: 8346195: Fix static initialization problem in GDIHashtable
  • a5503fb: 8346432: java.lang.foreign.Linker comment typo
  • fbd76ca: 8337016: serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java gets Metaspace OOM
  • baeb3d9: 8346304: SA doesn't need a copy of getModifierFlags
  • 99af595: 8345942: Separate source output from class output when building microbenchmarks
  • 8a64595: 8346282: [JVMCI] Add failure reason support to UnresolvedJava/Type/Method/Field
  • 725079b: 8345506: jar --validate may lead to java.nio.file.FileAlreadyExistsException
  • ... and 132 more: https://git.openjdk.org/jdk/compare/470701f0bb269834cc0e1cb40f7d34e92226454b...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8338714 8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual. Dec 6, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 6, 2024
@openjdk
Copy link

openjdk bot commented Dec 6, 2024

@plummercj The following label will be automatically applied to this pull request:

  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label Dec 6, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 6, 2024

Webrevs

}
}

public void run1() {
Copy link
Contributor

@AlanBateman AlanBateman Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a bit clear to rename run1 to runPinned or something better to avoid run + run1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also needs to support test runs with platforms threads. See how run() checks if it is running in virtual thread mode or not. Either way it calls run(), but in the virtual thread case it does so using VThreadPinner.

@@ -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);
Copy link
Contributor

@AlanBateman AlanBateman Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I wasn't sure how this would inherit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unrelated change. ???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jdk.test.lib.thread.VThreadPinner has a native library that must be loaded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see. Thanks

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good modulo potential renaming of the run1() method.

@plummercj
Copy link
Contributor Author

plummercj commented Dec 9, 2024

The fix looks good modulo potential renaming of the run1() method.

I think you and @AlanBateman didn't quite understand what I meant by:

It also needs to support test runs with platforms threads. See how run() checks if it is running in virtual thread mode or not. Either way it calls run(), but in the virtual thread case it does so using VThreadPinner.

The run1() method is called regardless of whether or not we are using vthreads and VThreadPinner, so I don't think runPinned() is a good name for it.

@sspitsyn
Copy link
Contributor

sspitsyn commented Dec 9, 2024

I think you and @AlanBateman didn't quite understand what I meant by:
. . .
The run1() method is called regardless of whether or not we are using vthreads and VThreadPinner, so I don't think runPinned() is a good name for it.

In fact, I understand it. I was thinking if renaming to something like runPlatformOrPinnedVirtual() would work. But there is no pressure from me on this as the method name will become kind of lengthy. :)

@plummercj
Copy link
Contributor Author

I think you and @AlanBateman didn't quite understand what I meant by:
. . .
The run1() method is called regardless of whether or not we are using vthreads and VThreadPinner, so I don't think runPinned() is a good name for it.

In fact, I understand it. I was thinking if renaming to something like runPlatformOrPinnedVirtual() would work. But there is no pressure from me on this as the method name will become kind of lengthy. :)

It is wordy. Maybe runShared or runCommon, although I don't think either adds much value.

@sspitsyn
Copy link
Contributor

sspitsyn commented Dec 11, 2024

It is wordy. Maybe runShared or runCommon, although I don't think either adds much value.

Or it can be just something like doit() or test(). :)

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 11, 2024
@plummercj
Copy link
Contributor Author

Looking for one more review. Thanks!

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hitting approve, but the launcher change seems unrelated to the issue at hand.

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unrelated change. ???

@plummercj plummercj changed the title 8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual. 8338714: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with JTREG_TEST_THREAD_FACTORY=Virtual Dec 17, 2024
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated labels Dec 17, 2024
@plummercj
Copy link
Contributor Author

Thanks David and Serguei!

/integrate

@openjdk
Copy link

openjdk bot commented Dec 17, 2024

Going to push as commit 414eb6b.
Since your change was applied there have been 142 commits pushed to the master branch:

  • dc71e8c: 8342995: Enhance Attach API to support arbitrary length arguments - Linux
  • 4f44cf6: 8341481: [perf] vframeStreamCommon constructor may be optimized
  • 390b205: 8346048: test/lib/containers/docker/DockerRunOptions.java uses addJavaOpts() from ctor
  • 03821d9: 8346195: Fix static initialization problem in GDIHashtable
  • a5503fb: 8346432: java.lang.foreign.Linker comment typo
  • fbd76ca: 8337016: serviceability/jvmti/RedefineClasses/RedefineLeakThrowable.java gets Metaspace OOM
  • baeb3d9: 8346304: SA doesn't need a copy of getModifierFlags
  • 99af595: 8345942: Separate source output from class output when building microbenchmarks
  • 8a64595: 8346282: [JVMCI] Add failure reason support to UnresolvedJava/Type/Method/Field
  • 725079b: 8345506: jar --validate may lead to java.nio.file.FileAlreadyExistsException
  • ... and 132 more: https://git.openjdk.org/jdk/compare/470701f0bb269834cc0e1cb40f7d34e92226454b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 17, 2024
@openjdk openjdk bot closed this Dec 17, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 17, 2024
@openjdk
Copy link

openjdk bot commented Dec 17, 2024

@plummercj Pushed as commit 414eb6b.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants