Skip to content
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

8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM #11204

Closed
wants to merge 4 commits into from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Nov 17, 2022

The VirtualThread static field notifyJvmtiEvents is not set correctly in cases JVMTI agents are loaded into running VM. It is because an extra call to java_lang_VirtualThread::init_static_notify_jvmti_events() is needed.
This function is called once at the VM initialization, so this extra call is not necessary for agent loaded at startup.

Testing:
New test is added: test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest
This test is failed without fix and passed with it.
TBD: run all JVMTI and JDI test in mach5.


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-8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11204

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 17, 2022

👋 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
Copy link

openjdk bot commented Nov 17, 2022

@sspitsyn The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Nov 17, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 17, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 17, 2022

Webrevs

@@ -382,7 +382,13 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
}
if (Continuations::enabled()) {
// Virtual threads support. There is a performance impact when VTMS transitions are enabled.
java_lang_VirtualThread::set_notify_jvmti_events(true);
if (!java_lang_VirtualThread ::notify_jvmti_events()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove extra space before ::

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. Will fix it.

Comment on lines +386 to 390
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
ThreadInVMfromNative __tiv(JavaThread::current());
java_lang_VirtualThread::init_static_notify_jvmti_events();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this looks good now. Removing the if (!java_lang_VirtualThread ::notify_jvmti_events()) check means the init_static_notify_jvmti_events() can still be called on subsequent calls to this method. So if init_static_notify_jvmti_events() was not called the first time (due to not being in the LIVE phase), then it can still be called on subsequent calls to this method if not in the LIVE phase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Thank you for the review, Chris,

@openjdk
Copy link

openjdk bot commented Nov 18, 2022

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

8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM

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

  • 2c692aa: 8297088: Update LCMS to 2.14
  • 9b4e0e8: 8297080: Remove com/sun/jdi/NashornPopFrameTest.java from the problem list
  • 3272954: 8297083: Remove vmTestbase/nsk/jvmti/GetAllThreads/allthr001 from problem list
  • c4b6920: 8296910: Add EdDSA/XDH/RSASSA-PSS to KeyPairGeneratorBench.java
  • f34ca80: 8297245: JFR: TestRemoteDump should use RemoteRecordingStream
  • 13158cb: 8293041: --disable-@files option doesn't work and cause an error
  • 761a4f4: 8295788: C2 compilation hits "assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node"
  • 2f2d404: 8297129: Inflater documentation refers to 'deflate' methods
  • dd18d76: 8297173: usageTicks and totalTicks should be volatile to ensure that different threads get the latest ticks
  • 2b6dbc7: 8293856: AArch64: Remove clear_inst_mark from aarch64_enc_java_dynamic_call
  • ... and 369 more: https://git.openjdk.org/jdk/compare/c5e0464098f8f7cd9c568c7b1c3a06139453eaab...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 Nov 18, 2022
@sspitsyn
Copy link
Contributor Author

Thank you for review, Leonid.

@sspitsyn
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 18, 2022

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

  • 59a308b: 8296632: Write a test to verify the content change of TextArea sends TextEvent
  • 11fc65f: 8023562: [TEST_BUG] java/awt/Mouse/EnterExitEvents/DragWindowTest.java failed on ubuntu 13 and mac 10.11
  • 2c692aa: 8297088: Update LCMS to 2.14
  • 9b4e0e8: 8297080: Remove com/sun/jdi/NashornPopFrameTest.java from the problem list
  • 3272954: 8297083: Remove vmTestbase/nsk/jvmti/GetAllThreads/allthr001 from problem list
  • c4b6920: 8296910: Add EdDSA/XDH/RSASSA-PSS to KeyPairGeneratorBench.java
  • f34ca80: 8297245: JFR: TestRemoteDump should use RemoteRecordingStream
  • 13158cb: 8293041: --disable-@files option doesn't work and cause an error
  • 761a4f4: 8295788: C2 compilation hits "assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node"
  • 2f2d404: 8297129: Inflater documentation refers to 'deflate' methods
  • ... and 371 more: https://git.openjdk.org/jdk/compare/c5e0464098f8f7cd9c568c7b1c3a06139453eaab...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 18, 2022

@sspitsyn Pushed as commit 035eaee.

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

@sspitsyn sspitsyn deleted the br17 branch December 15, 2022 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants