JDK-8068739 : G1CollectorPolicy uses uninitialized field '_sigma' in the constructor
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-01-09
  • Updated: 2015-06-03
  • Resolved: 2015-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b48Fixed
Related Reports
Relates :  
Relates :  
Description
The G1CollectorPolicy constructor uses a huge initializer list. In this list it calls "new SurvRateGroup(this, ..)" passing passing it a reference to the no yet fully initialized G1CollectorPolicy instance.

Via the following call chain, the SurvRateGroup constructor calls back to G1CollectorPolicy::get_new_prediction() which uses the uninitialzed value of G1CollectorPolicy::_sigma:

G1CollectorPolicy::G1CollectorPolicy
SurvRateGroup::SurvRateGroup
SurvRateGroup::reset
SurvRateGroup::all_surviving_words_recorded
G1CollectorPolicy::get_new_prediction

Depending on the indefinite value of '_sigma' this can lead to situations, where a GC is triggered before the whole system is initialized and ready for a GC resulting in the following crash:

Error occurred during initialization of VM
GC triggered before VM initialization completed. Try increasing NewSize, current value 5324K.

The fix is trivial - initialize the G1CollectorPolicy members in the right order

Comments
noreg-hard justification: the reported problems are dependent on "correct" bogus values in the heap during initialization.
13-01-2015