RFR: 8159464: DumpHeap.java hits assert in G1 code

Erik Helin erik.helin at oracle.com
Mon Jul 18 13:59:43 UTC 2016


Hi all,

this patch fixes an issue with the young gen sizing code in G1. The
problem is that the G1 policy uses a binary search to come up with the
young gen size, and the context for this binary search might change
while it is running. For this particular bug, a concurrent mark cycle
ended while the binary search was running. To fix this, we must save a
copy of all the state needed for the search.

I've looked through the code and as far as I can see the only data that
might change is the collector state (and the during_cm() state in
particular). The fix is to save the value of
collector_state()->during_cm() before the binary search. The data in
G1Analytics is not updated while the young gen sizing code is
running.

Bug:
https://bugs.openjdk.java.net/browse/JDK-8159464

Patches:
I split the patch into two steps to make it a bit easier to review:
1. Add const to a lot of variables to ensure that they don't change:
   http://cr.openjdk.java.net/~ehelin/8159464/00/add-const/
2. Move G1DefaultPolicy::predic_will_fit into its own class,
   G1YoungLenghtPredictor. The G1YoungLengthPredictor class takes the
   needed parameters in its constructor:
   http://cr.openjdk.java.net/~ehelin/8159464/00/fix-bug/

Testing:
- JPRT

Thanks,
Erik


More information about the hotspot-gc-dev mailing list