-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator incorrectly #10002
Conversation
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An interesting failure!
@shipilev 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:
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 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I worked on
test/jdk/java/util/concurrent/tck/LongAdderTest.java:testSerialization
test/jdk/java/util/concurrent/tck/DoubleAdderTest.java:testSerialization
I should have added similar tests back then, to
DoubleAccumulatorTest.java
LongAccumulatorTest.java
and that would allow deletion of Serial.java as a redundant test.
I would have done that now as well, but there's nothing wrong with this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surprising that this has lurked for 9 years without being noticed.
Thank you all! /integrate |
Going to push as commit 251bff6.
Your commit was automatically rebased without conflicts. |
JDK-8026344 added tests that subtly contradict the contract for
{Double,Long}Accumulator
-s, which breaks the tests on some platforms even in the single-threaded case.They use accumulators with binary plus as update function and using non-zero values as identity, which breaks once accumulators create many cells, reset their values to identity, and then apply the function over them, producing unexpected values.
See the investigation on RISC-V here:
https://mail.openjdk.org/pipermail/riscv-port-dev/2022-August/000594.html
We can do what
DoubleAccumulator
javadocs do as the sample, namely: "For example, to maintain a running maximum value, you could supply Double::max along with Double.NEGATIVE_INFINITY as the identity."Additional testing:
java/util/concurrent
testsProgress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10002/head:pull/10002
$ git checkout pull/10002
Update a local copy of the PR:
$ git checkout pull/10002
$ git pull https://git.openjdk.org/jdk pull/10002/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10002
View PR using the GUI difftool:
$ git pr show -t 10002
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10002.diff