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

8271353: PerfDataManager::destroy crashes in VM_Exit #4913

Closed
wants to merge 2 commits into from

Conversation

@navyxliu
Copy link
Contributor

@navyxliu navyxliu commented Jul 27, 2021

This patch check PerfDataManager::_sampled and _constants is NULL. if it is,
return -1.

When the user enables UL -Xlog:perf+datacreation=debug, it may crash in
PerfDataManager::destroy(). The following line will crash when _sampled is NULL.

  log_debug(perf, datacreation)("Total = %d, Sampled = %d, Constants = %d",
                                _all->length(), _sampled->length(), _constants->length());

This only happens when UsePerfData is on and PerfDataManager::destroy() is invoked before
StatSampler::initialize() which initializes PerfDataManager::_sampled.
PerfDataManager::destroy() is called by VM_Exit which can be triggered by SIGINT on Linux anytime.

A reproducible: invoke the following command and keep pressing Ctrl-c.
$perf stat -r 100 java -Xlog:perf+datacreation=debug --version


Progress

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

Issue

  • JDK-8271353: PerfDataManager::destroy crashes in VM_Exit

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4913

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jul 27, 2021

👋 Welcome back xliu! 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.

Loading

@openjdk openjdk bot added the rfr label Jul 27, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 27, 2021

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

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jul 27, 2021

Webrevs

Loading

Copy link
Member

@dholmes-ora dholmes-ora left a comment

The additional NULL checks seem fine and trivial.

Thanks,
David

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 28, 2021

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

8271353: PerfDataManager::destroy crashes in VM_Exit

Reviewed-by: dholmes, stuefe, minqi

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

  • 357947a: 8270061: Change parameter order of ResourceHashtable
  • 034788a: 8270925: replay dump using CICrashAt does not include inlining data
  • 9711033: 8209776: Refactor jdk/security/JavaDotSecurity/ifdefs.sh to plain java test
  • 60c11fe: 8261088: Repeatable annotations without @target cannot have containers that target module declarations
  • dcdb1b6: 8137101: [TEST_BUG] javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java failure due to timing
  • a066c7b: 8270086: ARM32-softfp: Do not load CONSTANT_double using the condy helper methods in the interpreter
  • 072fe48: 8270901: Typo PHASE_CPP in CompilerPhaseType
  • d7b5cb6: 8271368: [BACKOUT] JDK-8266054 VectorAPI rotate operation optimization
  • ecd4455: 8266510: Nimbus JTree default tree cell renderer does not use selected text color
  • d994b93: 8266054: VectorAPI rotate operation optimization
  • ... and 9 more: https://git.openjdk.java.net/jdk/compare/c8af8238b4b55d515573374800015e115042d883...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.

Loading

@openjdk openjdk bot added the ready label Jul 28, 2021
Copy link
Member

@tstuefe tstuefe left a comment

+1

Loading

Copy link
Contributor

@yminqi yminqi left a comment

Hi, Xin
The copyright year needs updated.
Maybe '0' is more meaningful than '-1'?

Loading

@navyxliu
Copy link
Contributor Author

@navyxliu navyxliu commented Jul 28, 2021

Hi, Xin
The copyright year needs updated.
Maybe '0' is more meaningful than '-1'?

Thanks for the head-up. I agree that 0 is easier to understand. I will update it.
PerfDataManager::add_item() "appends" a PerfData. if _sampled is not NULL, it should be at least 1.

Loading

yminqi
yminqi approved these changes Jul 28, 2021
@navyxliu
Copy link
Contributor Author

@navyxliu navyxliu commented Jul 28, 2021

Thank all reviewers.

Loading

Copy link
Member

@dholmes-ora dholmes-ora left a comment

I actually preferred the -1 to indicate "not available", but it doesn't really matter.

Thanks,
David

Loading

@navyxliu
Copy link
Contributor Author

@navyxliu navyxliu commented Jul 28, 2021

I have a same thought at first, but 0 isn't normal state. We can use 0 for N/A.

Loading

@navyxliu
Copy link
Contributor Author

@navyxliu navyxliu commented Jul 28, 2021

/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 28, 2021

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

  • 357947a: 8270061: Change parameter order of ResourceHashtable
  • 034788a: 8270925: replay dump using CICrashAt does not include inlining data
  • 9711033: 8209776: Refactor jdk/security/JavaDotSecurity/ifdefs.sh to plain java test
  • 60c11fe: 8261088: Repeatable annotations without @target cannot have containers that target module declarations
  • dcdb1b6: 8137101: [TEST_BUG] javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java failure due to timing
  • a066c7b: 8270086: ARM32-softfp: Do not load CONSTANT_double using the condy helper methods in the interpreter
  • 072fe48: 8270901: Typo PHASE_CPP in CompilerPhaseType
  • d7b5cb6: 8271368: [BACKOUT] JDK-8266054 VectorAPI rotate operation optimization
  • ecd4455: 8266510: Nimbus JTree default tree cell renderer does not use selected text color
  • d994b93: 8266054: VectorAPI rotate operation optimization
  • ... and 9 more: https://git.openjdk.java.net/jdk/compare/c8af8238b4b55d515573374800015e115042d883...master

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Jul 28, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 28, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 28, 2021

@navyxliu Pushed as commit 41b4c19.

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants