RFR(s): 8044796: G1: Enabled G1CollectedHeap::stop()
per.liden at oracle.com
Thu Jun 12 10:09:46 UTC 2014
Here's another (hopefully last) attempt at fixing issue with stopping
G1's concurrent threads at VM shutdown.
The previous attempt tried to abort any ongoing concurrent mark to speed
up the shutdown phase. This turned out to be a bad idea as it opened up
another race, which could result in threads getting stuck again. So,
this time I just wait for concurrent mark to complete before
terminating. We've talked internally here about some alternatives to
force an abort, but it seems all alternatives complicates the code way
too much and introduces new states which is hard to verify and it just
isn't worth it.
What worries me a bit is that the problems potentially introduced by a
change like this are very hard to detect as they tend to be race
conditions and show up only now and then. The previous fix had gone
through a fair bit of testing without showing any problems. This new fix
has gone thought 5 iterations of GC nightlies (Aurora adhoc
submissions), 3 iterations of gc-test-suite and passed all JTReg G1 tests.
About the fix. Since I no longer try to abort concurrent work the stop()
function became just a call to stop_conc_gc_threads(). Since
stop_conc_gc_threads() isn't used anywhere else I simply moved its
contents to stop() and removed stop_conc_gc_threads().
More information about the hotspot-gc-dev