Skip to content

JDK-8303069: Memory leak in CompilerOracle::parse_from_line #13060

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 1 commit into from

Conversation

dafedafe
Copy link
Contributor

@dafedafe dafedafe commented Mar 16, 2023

A memory leak has been detected using lsan when running the compiler/blackhole/BlackholeExperimentalUnlockTest.java test.

This happens when parsing the blackhole CompileCommand. There is a check for the -XX:+UnlockExperimentalVMOptions flag being enabled when blackhole is used. If this flag is not set, a warning gets printed and the CompileCommand is not taken.

Unfortunately this happens in register_commands where commands are supposed to be added to a list. In this case we bail out and the option is neither added nor deleted.

if (option == CompileCommand::Blackhole && !UnlockExperimentalVMOptions) {
warning("Blackhole compile option is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions");
return;
}

So, this changes deletes the matcher object before returning. This is done in register_commands (the callee) mainly because a couple of other similar checks are also done in this function.

The other option would have been to move the check to the caller (the only one for this case) before register_command:

if (option2type(option) == OptionType::Bool) {
register_command(matcher, option, true);
return;

but it seemed less appropriate (no other similar checks).

Letting it handle like other experimental flags (code below) is not an option either since in this case we have to do with a CompileCommand.

if (is_experimental() && !is_unlocked()) {
jio_snprintf(buf, buflen,
"Error: VM option '%s' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.\n"
"Error: The unlock option must precede '%s'.\n",
_name, _name);
return JVMFlag::EXPERIMENTAL_FLAG_BUT_LOCKED;
}


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-8303069: Memory leak in CompilerOracle::parse_from_line

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13060

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 16, 2023

👋 Welcome back dafedafe! 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 Mar 16, 2023

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

  • hotspot-compiler

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-compiler hotspot-compiler-dev@openjdk.org label Mar 16, 2023
Copy link
Member

@TobiHartmann TobiHartmann 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.

@dafedafe dafedafe marked this pull request as ready for review March 16, 2023 15:11
@openjdk
Copy link

openjdk bot commented Mar 16, 2023

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

8303069: Memory leak in CompilerOracle::parse_from_line

Reviewed-by: thartmann, jcking

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

  • b2639e1: 8304164: jdk/classfile/CorpusTest.java still fails after JDK-8303910
  • 620564a: 8304130: Add runtime/StackGuardPages/TestStackGuardPagesNative.java to ProblemList.txt
  • 9d518c5: 8299375: [PPC64] GetStackTraceSuspendedStressTest tries to deoptimize frame with invalid fp
  • ebac7ee: 8304063: tools/jpackage/share/AppLauncherEnvTest.java fails when checking LD_LIBRARY_PATH
  • 36995c5: 8304242: CPUInfoTest fails because "serialize" CPU feature is not known
  • 6b42275: 7154070: in SwingSet2, switching between LaFs it's easy to lose JTable dividers
  • 8eed7de: 8304146: Refactor VisibleMemberTable (LocalMemberTable)
  • a487a27: 8303150: DCmd framework unnecessarily creates a DCmd instance on registration
  • 2e987d7: 8304360: Test to ensure ConstantDescs fields work
  • 2f23c80: 8304225: Remove javax/script/Test7.java from ProblemList
  • ... and 17 more: https://git.openjdk.org/jdk/compare/01e6920581407bc3bd69db495fc694629ef01262...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@TobiHartmann, @jcking) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 16, 2023
@mlbridge
Copy link

mlbridge bot commented Mar 16, 2023

Webrevs

@dafedafe
Copy link
Contributor Author

Thanks a lot @TobiHartmann @jcking for your reviews!

@dafedafe
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 17, 2023
@openjdk
Copy link

openjdk bot commented Mar 17, 2023

@dafedafe
Your change (at version d8b69ae) is now ready to be sponsored by a Committer.

@TobiHartmann
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 17, 2023

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

  • 6dd6c15: 8301684: Fix test code to not get finalizer deprecation warnings
  • cb4ae19: 8292059: Do not inline InstanceKlass::allocate_instance()
  • b2639e1: 8304164: jdk/classfile/CorpusTest.java still fails after JDK-8303910
  • 620564a: 8304130: Add runtime/StackGuardPages/TestStackGuardPagesNative.java to ProblemList.txt
  • 9d518c5: 8299375: [PPC64] GetStackTraceSuspendedStressTest tries to deoptimize frame with invalid fp
  • ebac7ee: 8304063: tools/jpackage/share/AppLauncherEnvTest.java fails when checking LD_LIBRARY_PATH
  • 36995c5: 8304242: CPUInfoTest fails because "serialize" CPU feature is not known
  • 6b42275: 7154070: in SwingSet2, switching between LaFs it's easy to lose JTable dividers
  • 8eed7de: 8304146: Refactor VisibleMemberTable (LocalMemberTable)
  • a487a27: 8303150: DCmd framework unnecessarily creates a DCmd instance on registration
  • ... and 19 more: https://git.openjdk.org/jdk/compare/01e6920581407bc3bd69db495fc694629ef01262...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 17, 2023

@TobiHartmann @dafedafe Pushed as commit 384a8b8.

💡 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
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants