Skip to content

8307968: serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java timed out #13969

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 3 commits into from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented May 13, 2023

This is newly integrated test times out because it has a race in in the Test #A.1 and #A.2.
The main root cause is a print statement which can case target virtual thread to unpark and unmount.
This causes that the StopThreads unexpectedly fails with the JVMTI_ERROR_OPAQUE_FRAME error code.
The target thread can be in some other unexpected states if JVMTI StopThread
is called before the target thread method A() reached the synchronized statement.

The fix is to replace the ensureStarted() with the ensureAtPointA().
The fix also includes some simplifications related to clearing the target thread interrupt status.

Testing:
Hundreds of mach5 runs of serviceability/jvmti/vthread tests which include the fixed StopThreadTest.
TBD: To run mach5 tiers1-3.

The test does not fail with this fix anymore.


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-8307968: serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java timed out

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13969

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 13, 2023

👋 Welcome back sspitsyn! 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 openjdk bot added the rfr Pull request is ready for review label May 13, 2023
@openjdk
Copy link

openjdk bot commented May 13, 2023

@sspitsyn 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 May 13, 2023
@mlbridge
Copy link

mlbridge bot commented May 13, 2023

Webrevs

}
if (!seenExceptionFromA) {
StopThreadTest.setFailed("TestTask.run: expected AssertionError from method A()");
}
Thread.interrupted();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why this was move down this far. It seems you would want to do this before the StopThreadTest.setFailed() call just to be extra safe, so that means move it before the if statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion. Fixed.

@@ -248,6 +240,7 @@ public void run() {
// - when suspended: JVMTI_ERROR_NONE is expected
static void A() {
log("TestTask.A: started");
atPointA = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we are at the point where this flag has been set true, but we have not yet executed the monitorenter? Will the test pass if the StopThread is done a bit early here?

Copy link
Contributor Author

@sspitsyn sspitsyn May 16, 2023

Choose a reason for hiding this comment

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

Yes, the test will pass as the target virtual thread should still be in a good expected state.
#A.1: The StopThread should still return the JVMTI_ERROR_THREAD_NOT_SUSPENDED error code.
#A.2: The StopThread should return the JVMTI_ERROR_NONE as the target virtual thread has been mounted.

@openjdk
Copy link

openjdk bot commented May 16, 2023

@sspitsyn 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:

8307968: serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java timed out

Reviewed-by: cjplummer, lmesnik

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 21 new commits pushed to the master branch:

  • d22bcc8: 8307403: java/util/zip/DeInflate.java timed out
  • 2210e06: 8306638: Open source some AWT tests related to datatransfer and Toolkit
  • 05b51c7: 8307567: Avoid relocating global roots to metaspaceObjs in CDS dump
  • 3168372: 8306597: Improve string formatting in EquivMapsGenerator.java
  • 7b0b9b5: 8308049: Refactor nested class declarations in FdLibm.java
  • cc80ada: 8306593: Fix nsk/jdi/stop/stop001 for virtual threads and remove from problem list
  • 43c8c65: 8307555: Reduce memory reads in x86 MD5 intrinsic
  • 01892f9: 8304913: Use OperatingSystem, Architecture, and Version in jlink
  • 0f7b1c5: 8299340: CreateProcessW lpCommandLine must be mutable
  • 57e7a3f: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls
  • ... and 11 more: https://git.openjdk.org/jdk/compare/e54051ae9e1cdaa51a2d569227996a96b79bfa0d...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 added the ready Pull request is ready to be integrated label May 16, 2023
Copy link
Member

@lmesnik lmesnik left a comment

Choose a reason for hiding this comment

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

There is one nit related to code style.

@@ -104,7 +104,7 @@ public static void run() {
} else {
testTaskThread = Thread.ofPlatform().name("TestTaskThread").start(testTask);
}
testTask.ensureStarted();
testTask.ensureAtPointA();
Copy link
Member

Choose a reason for hiding this comment

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

Java Code Conventions recommends to use className and not variables while calling static methods. Same for 'ensureFinished()'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chris and Leonid, thank you for review!

@sspitsyn
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented May 16, 2023

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

  • d22bcc8: 8307403: java/util/zip/DeInflate.java timed out
  • 2210e06: 8306638: Open source some AWT tests related to datatransfer and Toolkit
  • 05b51c7: 8307567: Avoid relocating global roots to metaspaceObjs in CDS dump
  • 3168372: 8306597: Improve string formatting in EquivMapsGenerator.java
  • 7b0b9b5: 8308049: Refactor nested class declarations in FdLibm.java
  • cc80ada: 8306593: Fix nsk/jdi/stop/stop001 for virtual threads and remove from problem list
  • 43c8c65: 8307555: Reduce memory reads in x86 MD5 intrinsic
  • 01892f9: 8304913: Use OperatingSystem, Architecture, and Version in jlink
  • 0f7b1c5: 8299340: CreateProcessW lpCommandLine must be mutable
  • 57e7a3f: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls
  • ... and 11 more: https://git.openjdk.org/jdk/compare/e54051ae9e1cdaa51a2d569227996a96b79bfa0d...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 16, 2023

@sspitsyn Pushed as commit c2ef302.

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

@sspitsyn sspitsyn deleted the br33 branch May 16, 2023 07:21
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.

3 participants