Skip to content

Conversation

@xmas92
Copy link
Member

@xmas92 xmas92 commented Nov 19, 2024

This specific issue was known since #20888. As well as a more serious issue in calculate_extra_young_gc_time which may introduce a NaN. This specific issue is sane as long as we have IEEE 754 sans the C++ standard making division by zero UB.

As discussed in #21304 it is probably better to try and tackle the division by zero issue by making sure the input is never zero. This patch introduces a small offset to the average which will effectively leave the value unchanged unless it is zero, and behave as almost zero in calculations without causing actual division by zero.

There is still the issue with NaN, this patch adds a short circuit when this can occur and returns the analytical result of the calculation.


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-8344414: ZGC: Another division by zero in rule_major_allocation_rate (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22228

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 19, 2024

👋 Welcome back aboldtch! 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 Nov 19, 2024

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

8344414: ZGC: Another division by zero in rule_major_allocation_rate

Reviewed-by: eosterlund, stefank

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

  • ec93cc5: 8343932: Error when parsing qualified generic type test pattern in switch
  • c330b90: 8343780: Add since checker tests to the Tools area modules and add missing @SInCE to jdk.jfr
  • 8dada73: 8345120: A likely bug in StringSupport::chunkedStrlenShort
  • 659f70b: 8343418: Unnecessary Hashtable usage in CSS.htmlAttrToCssAttrMap
  • 5c8cb2e: 8337199: Add jcmd Thread.vthread_scheduler and Thread.vthread_pollers diagnostic commands
  • 3eb5461: 8343791: Socket.connect API should document whether the socket will be closed when hostname resolution fails or another error occurs
  • 4ac2e47: 8343800: Cleanup definition of NULL_WORD
  • a3b58ee: 8339983: [s390x] secondary_super_cache does not scale well: C1 and interpreter
  • e023add: 8345297: test/jdk/javax/swing/Action/8133039/bug8133039.java fails in ubuntu22.04
  • 40ae469: 8235786: Javadoc for com/sun/net/httpserver/HttpExchange.java#setAttribute is unclear
  • ... and 62 more: https://git.openjdk.org/jdk/compare/8485cb1ca1fa4885ddaf8381ebf862bbb233f090...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 rfr Pull request is ready for review label Nov 19, 2024
@openjdk
Copy link

openjdk bot commented Nov 19, 2024

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

  • hotspot-gc

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.

@mlbridge
Copy link

mlbridge bot commented Nov 19, 2024

Webrevs

@xmas92 xmas92 changed the title 8344414: ZGC: Another division by zero in rule_major_allocation_rate (ubsan) 8344414: ZGC: Another division by zero in rule_major_allocation_rate Nov 26, 2024
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.

Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 26, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Dec 2, 2024
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.

Even better.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 2, 2024
@xmas92
Copy link
Member Author

xmas92 commented Dec 3, 2024

Thanks for the reviews.
/integrate

@openjdk
Copy link

openjdk bot commented Dec 3, 2024

Going to push as commit 63af2f4.
Since your change was applied there have been 73 commits pushed to the master branch:

  • 077b842: 8345074: java.net.InterfaceAddress constructor could be made private
  • ec93cc5: 8343932: Error when parsing qualified generic type test pattern in switch
  • c330b90: 8343780: Add since checker tests to the Tools area modules and add missing @SInCE to jdk.jfr
  • 8dada73: 8345120: A likely bug in StringSupport::chunkedStrlenShort
  • 659f70b: 8343418: Unnecessary Hashtable usage in CSS.htmlAttrToCssAttrMap
  • 5c8cb2e: 8337199: Add jcmd Thread.vthread_scheduler and Thread.vthread_pollers diagnostic commands
  • 3eb5461: 8343791: Socket.connect API should document whether the socket will be closed when hostname resolution fails or another error occurs
  • 4ac2e47: 8343800: Cleanup definition of NULL_WORD
  • a3b58ee: 8339983: [s390x] secondary_super_cache does not scale well: C1 and interpreter
  • e023add: 8345297: test/jdk/javax/swing/Action/8133039/bug8133039.java fails in ubuntu22.04
  • ... and 63 more: https://git.openjdk.org/jdk/compare/8485cb1ca1fa4885ddaf8381ebf862bbb233f090...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 3, 2024

@xmas92 Pushed as commit 63af2f4.

💡 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-gc [email protected] integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants