-
Bug
-
Resolution: Fixed
-
P1
-
6.0, 6, 7, 8, 8u20, 8u31, 8u40, 9
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8082949 | emb-9 | Igor Veresov | P1 | Resolved | Fixed | team |
JDK-8086414 | 8u65 | Igor Veresov | P1 | Resolved | Fixed | b01 |
JDK-8072915 | 8u60 | Igor Veresov | P1 | Closed | Fixed | b04 |
JDK-8137678 | emb-8u65 | Unassigned | P1 | Resolved | Fixed | b01 |
JDK-8076688 | emb-8u60 | Igor Veresov | P1 | Resolved | Fixed | team |
JDK-8139137 | 7u101 | Vladimir Kempik | P1 | Resolved | Fixed | b01 |
JDK-8139790 | 7u95 | Igor Veresov | P1 | Closed | Fixed | b05 |
JDK-8155122 | openjdk7u | Igor Veresov | P1 | Resolved | Fixed | master |
JDK-8139138 | 6u111 | Vladimir Kempik | P1 | Closed | Won't Fix |
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
FULL OS VERSION :
Linux laptopi 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Linux thinkpad 3.18.5-1-ARCH #1 SMP PREEMPT Fri Jan 30 07:31:50 CET 2015 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
A code containing only simple arithmetic (generated using deterministic pseudorandom) randomly gives different results, even though it should be deterministic.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
REGRESSION. Last worked in version 7u75
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Save the code as code.java
2. Compile the code
$ javac code.java
3. Run the code repeatedly, observing the changes in output, for example
$ for i in {1..100}; do java code | sha256sum; done
EXPECTED VERSUS ACTUAL BEHAVIOR :
All the invocations of "java code" should output the same output with sha256 hash 629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838.
However, actual result contains many different outputs, like
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
0f2175f5f25089d63426ccf42b4e082cb51ad760c5a8534c764f8792c0ca46f4 -
c4a0bf7126460fd6ee02999121ec9a2d90c05b9bf27070d78de9a7605b4694e6 -
dc66d58743810f6a000d1ab4694b98eac85dcb4dffd99dfd43a6260b508ab007 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
a857ae2566df12c396990cb36828d646eb34c5e548e3c7f2af91e23782c5805e -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
d3bb7a3e570e4a8d0a7ae1fd3e6fccad4fbe8495b56ff08fdfbde70e00f19622 -
a82888399f7f4544e4ec230cf1b3e7b53ecc6571422b5e17b5b685ff9e655c79 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
a857ae2566df12c396990cb36828d646eb34c5e548e3c7f2af91e23782c5805e -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
c322caa467fcdd0e70519760c123b8fcf167e6cfdf98f648316f4e729643d77b -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
a857ae2566df12c396990cb36828d646eb34c5e548e3c7f2af91e23782c5805e -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
9c6eb5a688d7c78b9260baac02adf4720f0590b442c7d4ce5be64c755d66b5b7 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
d113cb8865e399499ae18a19bfd494b461a403fa7a5ff2fb30ad59c0ee575f91 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
0f2175f5f25089d63426ccf42b4e082cb51ad760c5a8534c764f8792c0ca46f4 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
629dbc538b4aa4fd16ecaefbf9cfcba1fe5910aec75740a84583dda03f044838 -
...
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
import java.util.*;
import java.io.*;
class code {
public static void main(String[] args) {
Random r = new Random(42);
int x = 0;
StringBuilder sb = new StringBuilder();
for(int i = 0; i < 1000000; ++i) {
int v = Math.abs(r.nextInt());
sb.append('+').append(v).append('\n');
x += v;
while(x < 0) x += 1000000000;
sb.append('=').append(x).append('\n');
}
System.out.println(sb.toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use -Xint.
- backported by
-
JDK-8076688 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8082949 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8086414 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8137678 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8139137 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8155122 Nondeterministic wrong answer on arithmetic
- Resolved
-
JDK-8072915 Nondeterministic wrong answer on arithmetic
- Closed
-
JDK-8139138 Nondeterministic wrong answer on arithmetic
- Closed
-
JDK-8139790 Nondeterministic wrong answer on arithmetic
- Closed
- relates to
-
JDK-8073735 [TEST_BUG] compiler/loopopts/CountedLoopProblem.java got OOME
- Resolved
1.
|
Release Note: Nondeterministic wrong answer on arithmetic corrected | Closed | Igor Veresov | ||
2.
|
Release note for JDK-8072753 | Closed | Unassigned |