Skip to content

Conversation

@navyxliu
Copy link
Member

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 27, 2021
@openjdk
Copy link

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.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Jul 27, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 27, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

The additional NULL checks seem fine and trivial.

Thanks,
David

@openjdk
Copy link

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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 28, 2021
Copy link
Member

@tstuefe tstuefe left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@yminqi yminqi left a comment

Choose a reason for hiding this comment

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

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

@navyxliu
Copy link
Member Author

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.

@navyxliu
Copy link
Member Author

Thank all reviewers.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

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

Thanks,
David

@navyxliu
Copy link
Member Author

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

@navyxliu
Copy link
Member Author

/integrate

@openjdk
Copy link

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.

@openjdk openjdk bot closed this Jul 28, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 28, 2021
@openjdk
Copy link

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.

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

Development

Successfully merging this pull request may close these issues.

4 participants