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

8282170: JVMTI SetBreakpoint metaspace allocation test #7554

Closed

Conversation

shipilev
Copy link
Contributor

@shipilev shipilev commented Feb 21, 2022

There are few bugs in SetBreakpoint when it reaches for metaspace allocation, notably JDK-8214992 and JDK-8264149. This adds the test that exercises the metaspace allocation paths.

Requires JDK-8282172 to pass cleanly in fastdebug mode.

Additional testing:

  • New test on Linux x86_64 fastdebug
  • New test on Linux x86_64 release
  • New test with JDK-8264149 reverted fails on Linux x86_64 release

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8282170: JVMTI SetBreakpoint metaspace allocation test

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7554/head:pull/7554
$ git checkout pull/7554

Update a local copy of the PR:
$ git checkout pull/7554
$ git pull https://git.openjdk.java.net/jdk pull/7554/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7554

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7554.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 21, 2022

👋 Welcome back shade! 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 label Feb 21, 2022
@openjdk
Copy link

openjdk bot commented Feb 21, 2022

@shipilev 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 label Feb 21, 2022
@mlbridge
Copy link

mlbridge bot commented Feb 21, 2022

Webrevs

@plummercj
Copy link
Contributor

plummercj commented Feb 22, 2022

So you load a class 50 times in separate ClassLoaders, and each load triggers the ClassPrepare event, and each time that happens you set a breakpoint on each of the 1000 methods, meaning a total of 5000 breakpoints. Doing this will eventually trigger calling CollectorPolicy::satisfy_failed_metadata_allocation(). Previous to the 8264149 fix, this used to trigger an assert. Am I understanding this properly?

@shipilev
Copy link
Contributor Author

shipilev commented Feb 23, 2022

So you load a class 50 times in separate ClassLoaders, and each load triggers the ClassPrepare event, and each time that happens you set a breakpoint on each of the 1000 methods, meaning a total of 5000 breakpoints. Doing this will eventually trigger calling CollectorPolicy::satisfy_failed_metadata_allocation(). Previous to the 8264149 fix, this used to trigger an assert. Am I understanding this properly?

Yes. That assert is actually the part of the larger issue: metaspace is full, GC is requested, and VM would probably hang if we allow it to happen, since we cannot easily schedule Full GCs when already at safepoint.

@openjdk
Copy link

openjdk bot commented Feb 28, 2022

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

8282170: JVMTI SetBreakpoint metaspace allocation test

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

  • fdce97d: 8267820: (fs) Files.copy should attempt to copy POSIX attributes when target file in custom file system
  • e8a1ce0: 8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException
  • 1668c02: 8277922: Unable to click JCheckBox in JTable through Java Access Bridge
  • 2674799: 8282878: Removed _JavaThread from PhaseTraceTime
  • 7c8ea9f: 8282509: [exploded image] ResolvedClassTest fails with similar output
  • 9c88c5b: 8282948: JDK-8274980 missed correct handling of MACOSX_BUNDLE_BUILD_VERSION
  • 83d7718: 8282893: Remove MacroAssembler::push/pop_callee_saved_registers
  • 6a3a7b9: 6218162: DefaultTableColumnModel.getColumn() method should mention ArrayIndexOutOfBoundsException
  • 5b78a82: 7017094: ParsedSynthStyle: parameter name "direction" should be changed to "tabIndex"
  • 8aba4de: 8249592: Robot.mouseMove moves cursor to incorrect location when display scale varies and Java runs in DPI Unaware mode
  • ... and 19 more: https://git.openjdk.java.net/jdk/compare/65ca0a5776df229ee91f420585ca1e8f91e489c6...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 label Feb 28, 2022
@shipilev
Copy link
Contributor Author

shipilev commented Mar 1, 2022

Thanks @plummercj! Anyone else to review?

@shipilev
Copy link
Contributor Author

shipilev commented Mar 7, 2022

Thanks @plummercj! Anyone else to review?

Friendly reminder.

@shipilev
Copy link
Contributor Author

shipilev commented Mar 8, 2022

I also rewritten the test to use bundled ASM instead of long target class. This also allows bumping the number of methods in the target without adding a lot of new lines.

lmesnik
lmesnik approved these changes Mar 8, 2022
Copy link
Member

@lmesnik lmesnik left a comment

thank you for fixing

@sspitsyn
Copy link
Contributor

sspitsyn commented Mar 9, 2022

Not a review yet but I'd suggest to convert .c to .cpp.
In long term we would like to get rid of the *.c files in the serviceability/jvmti test folder for consistency.

@shipilev
Copy link
Contributor Author

shipilev commented Mar 9, 2022

Not a review yet but I'd suggest to convert .c to .cpp. In long term we would like to get rid of the *.c files in the serviceability/jvmti test folder for consistency.

Good thinking. I converted the test to C++, and this also allowed to simplify the JNI/JVMTI calls a bit.

@shipilev
Copy link
Contributor Author

shipilev commented Mar 10, 2022

@lmesnik, @plummercj -- please re-ack the new version, thanks.

@shipilev
Copy link
Contributor Author

shipilev commented Mar 10, 2022

Thanks!

/integrate

@openjdk
Copy link

openjdk bot commented Mar 10, 2022

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

  • b13cacc: 8254574: PrintWriter handling of InterruptedIOException should be removed
  • 1f29523: 8282932: a space is needed for the unsupported protocol exception message in ProtocolVersion
  • 879b644: 8282897: Fix call parameter to GetStringChars() in HostLocaleProviderAdapter_md.c
  • fdce97d: 8267820: (fs) Files.copy should attempt to copy POSIX attributes when target file in custom file system
  • e8a1ce0: 8280881: (fs) UnixNativeDispatcher.close0 may throw UnixException
  • 1668c02: 8277922: Unable to click JCheckBox in JTable through Java Access Bridge
  • 2674799: 8282878: Removed _JavaThread from PhaseTraceTime
  • 7c8ea9f: 8282509: [exploded image] ResolvedClassTest fails with similar output
  • 9c88c5b: 8282948: JDK-8274980 missed correct handling of MACOSX_BUNDLE_BUILD_VERSION
  • 83d7718: 8282893: Remove MacroAssembler::push/pop_callee_saved_registers
  • ... and 22 more: https://git.openjdk.java.net/jdk/compare/65ca0a5776df229ee91f420585ca1e8f91e489c6...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated label Mar 10, 2022
@openjdk openjdk bot closed this Mar 10, 2022
@openjdk openjdk bot removed ready rfr labels Mar 10, 2022
@openjdk
Copy link

openjdk bot commented Mar 10, 2022

@shipilev Pushed as commit 7b91bbb.

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

@shipilev shipilev deleted the JDK-8282170-jvmti-setbreakpoint-test branch Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated serviceability
4 participants