-
Bug
-
Resolution: Fixed
-
P3
-
8u152
-
b32
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.8.0_152-ea"
Java(TM) SE Runtime Environment (build 1.8.0_152-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.12.5
A DESCRIPTION OF THE PROBLEM :
In certain multithreading situations, some local variables are not being initialized properly. This seems to happen when a function declares multiple block-scoped variables that are captured by a closure, and when the function is invoked concurrently from multiple threads.
When this bug is triggered, the following code may throw a TypeError due to "x" being undefined:
const x = [1,2,3];
x.concat(4);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided script several times, for example:
for i in {0..10}
do
echo Attempt $i
jjs --language=es6 crash.js
done
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The .js script should not generate any output, so the above 'for' loop should display the following:
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
Attempt 6
Attempt 7
Attempt 8
Attempt 9
Attempt 10
ACTUAL -
This test case reproduces the issue about 50% of the time.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 6
Attempt 7
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 8
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 9
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 10
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
function f() {
let a;
const b = {};
b.crash; // b is sometimes undefined
function() {
a, b;
}
}
T = Java.extend(Java.type('java.lang.Thread'), {
run: function() {
for (let j = 0; j < 100; j++) {
try {
f();
}
catch (e) {
print(e);
break;
}
}
}
});
new T().start();
new T().start();
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either of the following will eliminate the issue, in this particular test case:
- Declare 'a' as 'var'
- Declare 'b' as 'let' or 'var'
java version "1.8.0_152-ea"
Java(TM) SE Runtime Environment (build 1.8.0_152-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.12.5
A DESCRIPTION OF THE PROBLEM :
In certain multithreading situations, some local variables are not being initialized properly. This seems to happen when a function declares multiple block-scoped variables that are captured by a closure, and when the function is invoked concurrently from multiple threads.
When this bug is triggered, the following code may throw a TypeError due to "x" being undefined:
const x = [1,2,3];
x.concat(4);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided script several times, for example:
for i in {0..10}
do
echo Attempt $i
jjs --language=es6 crash.js
done
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The .js script should not generate any output, so the above 'for' loop should display the following:
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
Attempt 6
Attempt 7
Attempt 8
Attempt 9
Attempt 10
ACTUAL -
This test case reproduces the issue about 50% of the time.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 6
Attempt 7
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 8
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 9
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 10
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
function f() {
let a;
const b = {};
b.crash; // b is sometimes undefined
function() {
a, b;
}
}
T = Java.extend(Java.type('java.lang.Thread'), {
run: function() {
for (let j = 0; j < 100; j++) {
try {
f();
}
catch (e) {
print(e);
break;
}
}
}
});
new T().start();
new T().start();
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either of the following will eliminate the issue, in this particular test case:
- Declare 'a' as 'var'
- Declare 'b' as 'let' or 'var'
Uninitialized const when using multiple threads
-
Bug
-
Resolution: Fixed
-
P3
-
8u152
-
b32
-
generic
-
generic
FULL PRODUCT VERSION :
java version "1.8.0_152-ea"
Java(TM) SE Runtime Environment (build 1.8.0_152-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.12.5
A DESCRIPTION OF THE PROBLEM :
In certain multithreading situations, some local variables are not being initialized properly. This seems to happen when a function declares multiple block-scoped variables that are captured by a closure, and when the function is invoked concurrently from multiple threads.
When this bug is triggered, the following code may throw a TypeError due to "x" being undefined:
const x = [1,2,3];
x.concat(4);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided script several times, for example:
for i in {0..10}
do
echo Attempt $i
jjs --language=es6 crash.js
done
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The .js script should not generate any output, so the above 'for' loop should display the following:
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
Attempt 6
Attempt 7
Attempt 8
Attempt 9
Attempt 10
ACTUAL -
This test case reproduces the issue about 50% of the time.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 6
Attempt 7
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 8
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 9
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 10
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
function f() {
let a;
const b = {};
b.crash; // b is sometimes undefined
function() {
a, b;
}
}
T = Java.extend(Java.type('java.lang.Thread'), {
run: function() {
for (let j = 0; j < 100; j++) {
try {
f();
}
catch (e) {
print(e);
break;
}
}
}
});
new T().start();
new T().start();
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either of the following will eliminate the issue, in this particular test case:
- Declare 'a' as 'var'
- Declare 'b' as 'let' or 'var'
java version "1.8.0_152-ea"
Java(TM) SE Runtime Environment (build 1.8.0_152-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
macOS 10.12.5
A DESCRIPTION OF THE PROBLEM :
In certain multithreading situations, some local variables are not being initialized properly. This seems to happen when a function declares multiple block-scoped variables that are captured by a closure, and when the function is invoked concurrently from multiple threads.
When this bug is triggered, the following code may throw a TypeError due to "x" being undefined:
const x = [1,2,3];
x.concat(4);
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the provided script several times, for example:
for i in {0..10}
do
echo Attempt $i
jjs --language=es6 crash.js
done
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The .js script should not generate any output, so the above 'for' loop should display the following:
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
Attempt 6
Attempt 7
Attempt 8
Attempt 9
Attempt 10
ACTUAL -
This test case reproduces the issue about 50% of the time.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attempt 0
Attempt 1
Attempt 2
Attempt 3
Attempt 4
Attempt 5
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 6
Attempt 7
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 8
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 9
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
Attempt 10
TypeError: Cannot read property "crash" from undefined
TypeError: Cannot read property "crash" from undefined
REPRODUCIBILITY :
This bug can be reproduced often.
---------- BEGIN SOURCE ----------
function f() {
let a;
const b = {};
b.crash; // b is sometimes undefined
function() {
a, b;
}
}
T = Java.extend(Java.type('java.lang.Thread'), {
run: function() {
for (let j = 0; j < 100; j++) {
try {
f();
}
catch (e) {
print(e);
break;
}
}
}
});
new T().start();
new T().start();
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Either of the following will eliminate the issue, in this particular test case:
- Declare 'a' as 'var'
- Declare 'b' as 'let' or 'var'