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

8264752: JFR crash when only specify threadbuffersize=30M #3355

Closed
wants to merge 2 commits into from

Conversation

huishi-hs
Copy link

@huishi-hs huishi-hs commented Apr 6, 2021

SIGFPE crash happens in release build with following JFR crash options. Because div_total_by_per_unit try to divide smaller memorysize with larger threadbuffersize.

div_total_by_per_unit
  const julong units = total_pages / per_unit_pages;    // units is zero
  const julong rem = total_pages % per_unit_pages;

  assert(units > 0, "invariant");

  if (rem > 0) {
    total_pages -= rem % units;
    per_unit_pages += rem / units;     // SIGFPE happen
  }

-XX:StartFlightRecording -XX:FlightRecorderOptions:threadbuffersize=30M
-XX:StartFlightRecording -XX:FlightRecorderOptions:threadbuffersize=30M,memorysize=10M

Fix includes

  1. if threadbuffersize is larger than memorysize, fail with message
[0.019s][error][arguments] Value specified for option "memorysize" is 10M
[0.019s][error][arguments] Value specified for option "threadbuffersize" is 30M
[0.019s][error][arguments] The value for option "threadbuffersize" should not be larger than the value specified for option "memorysize
  1. In "thread_buffer_size(JfrMemoryOptions* options)", If memor_size is not configured, calculate new memory_size according to buffer_size and buffer_count. Avoid possible SIGFPE in div_total_by_per_unit.

There are other assertions in debug build with JFR options, leave them in other bug fix (https://bugs.openjdk.java.net/browse/JDK-8241773)

  1. -XX:FlightRecorderOptions:threadbuffersize=6M,memorysize=10M assert(options.buffer_count >= MIN_BUFFER_COUNT) failed: invariant
  2. -XX:FlightRecorderOptions:globalbuffersize=4G assert(free_size() == size) failed: invariant
  3. -XX:FlightRecorderOptions:threadbuffersize=4G assert(free_size() == size) failed: invariant

Progress

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

Issue

  • JDK-8264752: JFR crash when only specify threadbuffersize=30M

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3355

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 6, 2021

👋 Welcome back hshi! 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 Apr 6, 2021
@openjdk
Copy link

openjdk bot commented Apr 6, 2021

@huishi-hs The following label will be automatically applied to this pull request:

  • hotspot-jfr

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-jfr hotspot-jfr-dev@openjdk.org label Apr 6, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 6, 2021

Webrevs

@huishi-hs
Copy link
Author

@huishi-hs huishi-hs closed this Apr 12, 2021
@huishi-hs huishi-hs deleted the JFR_crash branch April 12, 2021 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-jfr hotspot-jfr-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

1 participant