-
Bug
-
Resolution: Fixed
-
P3
-
7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8001526 | 8 | Rickard Backman | P3 | Resolved | Fixed | b62 |
JDK-8017983 | 7u45 | Rickard Backman | P3 | Closed | Fixed | b01 |
JDK-8001051 | hs25 | Rickard Backman | P3 | Resolved | Fixed | b06 |
JDK-8001115 | hs24 | Rickard Backman | P3 | Closed | Fixed | b23 |
FULL PRODUCT VERSION :
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
It seems that with jdk7, the jvmtiPrimitiveFieldCallback used with IterateThroughHeap() always reports 0's for static primitive fields. Non-static primitive fields seem to be reported correctly.
REGRESSION. Last worked in version 6u26
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java-sample:
class Test {
private float pi = 3.1415927f;
private static float pipi = 3.1415927f;
private static String aString = “hello”;
}
Write an agent that does an IterateThroughHeap(), the jvmtiPrimitiveFieldCallback always reports 3.415927 for the non-static field "pi" of an instance of this class and 0 for the static field "pipi". This was working in Java6.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I'd exepcted that (as for java6) jvmtiPrimitiveFieldCallback returns 3.1415927 for "pipi" in the example above
ACTUAL -
0 instead of 3.1415927 for "pipi" in the example above
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
public class Test {
private static String aString = "hello";
private float pi = 3.1415927f;
private static float pipi = 3.1415927f;
public static void main(String[] args) throws Exception {
Test test = new Test();
waitForEnter();
}
public Test() {
}
private static void waitForEnter() throws IOException {
System.out.println("waiting for ENTER, pipi="+pipi);
System.in.skip(System.in.available());
System.in.read();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none found
1) To run the reproducer, use runStaticFields.cmd.
C:\devtools\jdk1.7.0_x64\bin\java -agentpath:".\win64\lib\dtdagent.dll" StaticFields
rem C:\devtools\jdk1.6.0_31_x64\bin\java -agentpath:".\win64\lib\dtdagent.dll" StaticFields
You have to adapt JRE locations in this script first.
2) relevant agent-source is in Agent.cpp, please note that this is a highly stripped-down version of our agent and error-checking is not done.
3) when run with a JDK1.6.x_64, you will get something similar to waiting for ENTER, pipi=2.1415927 doDump invoked found instance of TestClass found primitiveField of TestClass (instance)
float-value:3.141593
found primitiveField of TestClass (static)
float-value:2.141593 ( <===== )
VMDeath
4) when running with JDK1.7.0_64, you will get something similar to the following, please note that the float-value of the static-field is 0.00 although it is 2.1415 from java and when running with jdk1.6 waiting for ENTER, pipi=2.1415927 doDump invoked found primitiveField of TestClass (static)
float-value:0.000000 ( <===== )
found instance of TestClass
found primitiveField of TestClass (instance)
float-value:3.141593
VMDeath
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
It seems that with jdk7, the jvmtiPrimitiveFieldCallback used with IterateThroughHeap() always reports 0's for static primitive fields. Non-static primitive fields seem to be reported correctly.
REGRESSION. Last worked in version 6u26
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java-sample:
class Test {
private float pi = 3.1415927f;
private static float pipi = 3.1415927f;
private static String aString = “hello”;
}
Write an agent that does an IterateThroughHeap(), the jvmtiPrimitiveFieldCallback always reports 3.415927 for the non-static field "pi" of an instance of this class and 0 for the static field "pipi". This was working in Java6.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I'd exepcted that (as for java6) jvmtiPrimitiveFieldCallback returns 3.1415927 for "pipi" in the example above
ACTUAL -
0 instead of 3.1415927 for "pipi" in the example above
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
public class Test {
private static String aString = "hello";
private float pi = 3.1415927f;
private static float pipi = 3.1415927f;
public static void main(String[] args) throws Exception {
Test test = new Test();
waitForEnter();
}
public Test() {
}
private static void waitForEnter() throws IOException {
System.out.println("waiting for ENTER, pipi="+pipi);
System.in.skip(System.in.available());
System.in.read();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none found
1) To run the reproducer, use runStaticFields.cmd.
C:\devtools\jdk1.7.0_x64\bin\java -agentpath:".\win64\lib\dtdagent.dll" StaticFields
rem C:\devtools\jdk1.6.0_31_x64\bin\java -agentpath:".\win64\lib\dtdagent.dll" StaticFields
You have to adapt JRE locations in this script first.
2) relevant agent-source is in Agent.cpp, please note that this is a highly stripped-down version of our agent and error-checking is not done.
3) when run with a JDK1.6.x_64, you will get something similar to waiting for ENTER, pipi=2.1415927 doDump invoked found instance of TestClass found primitiveField of TestClass (instance)
float-value:3.141593
found primitiveField of TestClass (static)
float-value:2.141593 ( <===== )
VMDeath
4) when running with JDK1.7.0_64, you will get something similar to the following, please note that the float-value of the static-field is 0.00 although it is 2.1415 from java and when running with jdk1.6 waiting for ENTER, pipi=2.1415927 doDump invoked found primitiveField of TestClass (static)
float-value:0.000000 ( <===== )
found instance of TestClass
found primitiveField of TestClass (instance)
float-value:3.141593
VMDeath
- backported by
-
JDK-8001051 JVMTI: jvmtiPrimitiveFieldCallback always report 0's for static primitives
- Resolved
-
JDK-8001526 JVMTI: jvmtiPrimitiveFieldCallback always report 0's for static primitives
- Resolved
-
JDK-8001115 JVMTI: jvmtiPrimitiveFieldCallback always report 0's for static primitives
- Closed
-
JDK-8017983 JVMTI: jvmtiPrimitiveFieldCallback always report 0's for static primitives
- Closed
- relates to
-
JDK-7017732 move static fields into Class to prepare for perm gen removal
- Closed