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

8303070: Memory leak in DCmdArgument<char*>::parse_value #12737

Closed
wants to merge 5 commits into from

Conversation

dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Feb 24, 2023

If we have a default value for the char* DCmdArgument we copy it into the _value field using parse_value to make a copy in C-heap. If we then parse an actual argument value, we replace the default but don't free it. The parse method needs to use realloc.

Thanks to @jcking for spotting the cause.

Testing: tiers 1-3

Thanks.


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-8303070: Memory leak in DCmdArgument<char*>::parse_value

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12737

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 24, 2023

👋 Welcome back dholmes! 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 Feb 24, 2023
@openjdk
Copy link

openjdk bot commented Feb 24, 2023

@dholmes-ora The following label will be automatically applied to this pull request:

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Feb 24, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 24, 2023

Webrevs

Copy link
Contributor

@fparain fparain 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 to me.

@dholmes-ora dholmes-ora requested review from jcking, coleenp and fparain and removed request for jcking and coleenp February 25, 2023 02:30
@dholmes-ora
Copy link
Member Author

Thanks for looking at this @fparain , @jcking and @coleenp. The null case has been fixed and the associated test updated to hit that path. Please re-review. Thanks.

@dholmes-ora
Copy link
Member Author

@fparain and @coleenp could you re-review please. Thank you.

Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

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

The change looks good. Since I was asked to review in Coleen's absence, I feel like I just have to mention it's a bit weird that a template specialization of destroy_value causes different behaviour, and that I don't really like templates. But the change looks good.

@openjdk
Copy link

openjdk bot commented Mar 1, 2023

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

8303070: Memory leak in DCmdArgument<char*>::parse_value

Reviewed-by: fparain, jcking, jsjolen, eosterlund, coleenp

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

  • 8b86e1e: 8303344: After JDK-8302760, G1 heap verification does not exit VM after errors
  • 4c5d9cf: 8303013: Always do remembered set verification during G1 Full GC
  • 2451c5a: 8303357: [JVMCI] thread is _thread_in_vm when committing JFR compilation event
  • 539a495: 8302798: Refactor -XX:+UseOSErrorReporting for noreturn crash reporting
  • 6b07243: 8301630: C2: 8297933 broke type speculation in some cases
  • 3aeefbf: 8303421: [BACKOUT] 8303133: Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed.
  • 1fdaf25: 8303133: Update ProcessTools.startProcess(...) to exit early if process exit before linePredicate is printed.
  • 65da2c5: 8303412: Update linux_x64-to-linux_aarch64 cross compilation devkit at Oracle
  • 7e47d51: 8282319: java.util.Locale method to stream available Locales
  • 8815175: 8303216: Prefer ArrayList to LinkedList in sun.net.httpserver.ServerImpl
  • ... and 57 more: https://git.openjdk.org/jdk/compare/fcaf871408321ed523cf1c6dd3adf9914f2bf9aa...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 Mar 1, 2023
@dholmes-ora
Copy link
Member Author

I feel like I just have to mention it's a bit weird that a template specialization of destroy_value causes different behaviour

@fisk I don't follow your comment. The issue is missing free - hence use of realloc. But thanks for the review :)

@dholmes-ora
Copy link
Member Author

Thanks for (re-) reviews @fparain , @coleenp and @jdksjolen !

/integrate

@openjdk
Copy link

openjdk bot commented Mar 1, 2023

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

  • 9fc518f: 8303401: Add a Vector API equalsIgnoreCase micro benchmark
  • 05faa73: 8303232: java.util.Date.parse(String) and java.util.Date(String) don't declare thrown IllegalArgumentException
  • 4c985e5: 8303183: Memory leak in Arguments::init_shared_archive_paths
  • 6af17c1: 8303362: Serial: Move CardTableRS to serial directory
  • c1e77e0: 8303252: G1: Return early from Full-GC if no regions are selected for compaction.
  • 8b86e1e: 8303344: After JDK-8302760, G1 heap verification does not exit VM after errors
  • 4c5d9cf: 8303013: Always do remembered set verification during G1 Full GC
  • 2451c5a: 8303357: [JVMCI] thread is _thread_in_vm when committing JFR compilation event
  • 539a495: 8302798: Refactor -XX:+UseOSErrorReporting for noreturn crash reporting
  • 6b07243: 8301630: C2: 8297933 broke type speculation in some cases
  • ... and 62 more: https://git.openjdk.org/jdk/compare/fcaf871408321ed523cf1c6dd3adf9914f2bf9aa...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 1, 2023

@dholmes-ora Pushed as commit 6e19387.

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

@dholmes-ora dholmes-ora deleted the 8303070-Dcmd branch March 2, 2023 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
7 participants