Null Pointer Exception occurs in 1.4.2_11.
Configuration :
UltraSparcII 400[MHz] *2
4[GB]
Solaris9
How to reproduce :
1. Compile attached .java programs
2. Launch
" java -server -cp . TestNPO 100"
in 1.4.2_11 on Solaris9 box.
The following message will show up.
...
Thread-72 start
Thread-83 start
Thread-54 start
Thread-52 start
Thread-81 start
Thread-88 start
Thread-58 start
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
NOTE:
The customer did reverse-assembling with java_g -server -XX:+PrintNMethod.
They sent the following report also.
----- Report -----
In compiled code out of NPO_Thread#run(),
the generated code of
nmw.npoMaker = new NPOMaker(new Foo("f2"));
is inlined.
If the code is not optimized, the code will be
tmp1 = new Foo();
tmp1.s = "f2";
tmp2 = new NPOMaker();
tmp2.foo = tmp1;
nmw.npoMaker = tmp2;
However, actual code is
tmp1 = new Foo();
tmp2 = new NPOMaker();
nmw.npoMaker = tmp2;
<<-- other trhead exec. nmw.npoMaker.print()
tmp2.foo = tmp1;
tmp1.s = "f2";
If other thread executes nmw.npoMaker.print() at the above "<<--"
NullPointerException seems to occur.
According to the source code, nmw.npoMaker is the reference to a variable
which will be referred by plural threads.
We want to clarify if the problem is bug or the implemetation of NPO_Thread.java
(Java Language Specs. Chapter 17.3 Rules about Variables)
----- Report end -----
Configuration :
UltraSparcII 400[MHz] *2
4[GB]
Solaris9
How to reproduce :
1. Compile attached .java programs
2. Launch
" java -server -cp . TestNPO 100"
in 1.4.2_11 on Solaris9 box.
The following message will show up.
...
Thread-72 start
Thread-83 start
Thread-54 start
Thread-52 start
Thread-81 start
Thread-88 start
Thread-58 start
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
java.lang.NullPointerException
NOTE:
The customer did reverse-assembling with java_g -server -XX:+PrintNMethod.
They sent the following report also.
----- Report -----
In compiled code out of NPO_Thread#run(),
the generated code of
nmw.npoMaker = new NPOMaker(new Foo("f2"));
is inlined.
If the code is not optimized, the code will be
tmp1 = new Foo();
tmp1.s = "f2";
tmp2 = new NPOMaker();
tmp2.foo = tmp1;
nmw.npoMaker = tmp2;
However, actual code is
tmp1 = new Foo();
tmp2 = new NPOMaker();
nmw.npoMaker = tmp2;
<<-- other trhead exec. nmw.npoMaker.print()
tmp2.foo = tmp1;
tmp1.s = "f2";
If other thread executes nmw.npoMaker.print() at the above "<<--"
NullPointerException seems to occur.
According to the source code, nmw.npoMaker is the reference to a variable
which will be referred by plural threads.
We want to clarify if the problem is bug or the implemetation of NPO_Thread.java
(Java Language Specs. Chapter 17.3 Rules about Variables)
----- Report end -----
- relates to
-
JDK-4477784 A "final" field can be read by one thread before its value is initialized.
- Resolved