FULL PRODUCT VERSION :
FULL OS VERSION :
any 64 bit;
Linux gremio 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
For printing the value of the "region-size", G1PrintRegionLivenessInfoClosure::G1PrintRegionLivenessInfoClosure uses SIZE_FORMAT, which is a format specifier for 64 bit values. However, the variable passed is an "int" (HeapRegion::GrainBytes), which is typically 32 bit on 64 bit platforms. This results in garbled output because the formatting function uses the full 64 bit of that memory location although only 32 bit are valid.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run any program with -XX:+G1PrintRegionLivenessInfo -XX:+UseG1GC that causes concurrent marking. The value of "region-size" often contains a random value in that output.
EXPECTED VERSUS ACTUAL BEHAVIOR :
-XX:+G1PrintRegionLivenessInfo -XX:+UseG1GC should result in correct output of region size information
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
There is a bug report at https://bugs.openjdk.java.net/show_bug.cgi?id=100197 which describes a few workarounds and provides a patch:
- case the HeapRegion::GrainBytes to a size_t (least intrusive)
- add a new format specifier for printing ints
- change HeapRegion::GrainBytes to a size_t