Skip to content

8312777: notifyJvmtiMount before notifyJvmtiUnmount #16194

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

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Oct 14, 2023

JVMTI is notified after a virtual thread unmounts. Right not, this notification is done after the virtual thread has finished parking or yielding so it's possible for the virtual to continue, and be mounted on a different carrier, before the unmount notification has completed on the original carrier. If this happens it means the the JVMTI mount and unmount notifications will race and it's possible they could be unbalanced. The unmount notification needs to move to after the unmount and before the virtual thread state is changed.

While in the area, I've removed @ChangesCurrentThread from VirtualThread.run. This annotation was in place to workaround an issue with the notifyJvmtiXXX instrinsics, fixed recently by JDK-8316130.

Testing: tier1-6.


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-8312777: notifyJvmtiMount before notifyJvmtiUnmount (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16194

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 14, 2023

👋 Welcome back alanb! 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 Oct 14, 2023

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Oct 14, 2023
@AlanBateman
Copy link
Contributor Author

/label remove core-libs
/label add serviceability

@openjdk openjdk bot removed the core-libs core-libs-dev@openjdk.org label Oct 14, 2023
@openjdk
Copy link

openjdk bot commented Oct 14, 2023

@AlanBateman
The core-libs label was successfully removed.

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label Oct 14, 2023
@openjdk
Copy link

openjdk bot commented Oct 14, 2023

@AlanBateman
The serviceability label was successfully added.

@AlanBateman AlanBateman marked this pull request as ready for review October 14, 2023 21:36
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 14, 2023
@mlbridge
Copy link

mlbridge bot commented Oct 14, 2023

Webrevs

Copy link

@Hamlin-Li Hamlin-Li left a comment

Choose a reason for hiding this comment

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

LGTM.

@openjdk
Copy link

openjdk bot commented Oct 15, 2023

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

8312777: notifyJvmtiMount before notifyJvmtiUnmount

Reviewed-by: mli, sspitsyn

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

  • 9cf334f: 8318383: Remove duplicated checks in os::get_native_stack() in posix implementation
  • defc7e0: 8318454: TestLayoutPaths broken on Big Endian platforms after JDK-8317837
  • 3c70f2c: 8318418: hsdis build fails with system binutils on Ubuntu
  • 15acf4b: 8318324: Drop redundant default methods from FFM API
  • 1a09835: 8317358: G1: Make TestMaxNewSize use createTestJvm
  • 47bb1a1: 8318415: Adjust describing comment of os_getChildren after 8315026
  • 80bd22d: 8316144: Remove unused field jdk.internal.util.xml.impl.XMLStreamWriterImpl.Element._Depth
  • c0e154c: 8318089: Class space not marked as such with NMT when CDS is off

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Oct 15, 2023
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.

Looks good. It is more elegant now.
I was thinking if it'd make sense to move:

  • notifyJvmtiMount(/*hide*/true); at start of mount()
  • notifyJvmtiUnmount(/*hide*/false); at end of unmount()
    but I guess you wanted to have them at the runContinuation() level.

Thanks,
Serguei

@AlanBateman
Copy link
Contributor Author

Looks good. It is more elegant now. I was thinking if it'd make sense to move:

  • notifyJvmtiMount(/*hide*/true); at start of mount()
  • notifyJvmtiUnmount(/*hide*/false); at end of unmount()
    but I guess you wanted to have them at the runContinuation() level.

I'd be happy to move them to mount/unmount. As I recall, this wasn't possible because it lead to unbalanced method enter/exit, e.g. enter mount, exit unmount. I can re-test with to see what issues we might have but I suspect you will remember the issues with balancing the enter/exit.

@AlanBateman
Copy link
Contributor Author

I tested tier1-tier6 with the JVMTI notifications moved to mount/unmount and don't see any failures. So if you are okay with that then it would be a bit nicer. The main thing is that the notification is done before the virtual thread state changes.

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.

Thank you for the update. It looks good to me.
Thanks,
Serguei

@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 20, 2023

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

  • 8f5f440: 8317692: jcmd GC.heap_dump performance regression after JDK-8292818
  • 684b91e: 8315064: j.text.ChoiceFormat provides no specification on quoting behavior
  • 1740950: 8314901: AES-GCM interleaved implementation using AVX2 instructions
  • cc8f8da: 8318322: Update IANA Language Subtag Registry to Version 2023-10-16
  • 599560a: 8317635: Improve GetClassFields test to verify correctness of field order
  • 9cf334f: 8318383: Remove duplicated checks in os::get_native_stack() in posix implementation
  • defc7e0: 8318454: TestLayoutPaths broken on Big Endian platforms after JDK-8317837
  • 3c70f2c: 8318418: hsdis build fails with system binutils on Ubuntu
  • 15acf4b: 8318324: Drop redundant default methods from FFM API
  • 1a09835: 8317358: G1: Make TestMaxNewSize use createTestJvm
  • ... and 3 more: https://git.openjdk.org/jdk/compare/24bc5bd104b8b4b96a61cffd3ec35cc795744eb9...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 20, 2023

@AlanBateman Pushed as commit c46a54e.

💡 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.

3 participants