JDK-8026752 : Cancel MetaspaceGC request for a CMS concurrent collection after GC
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.
The MetaspaceGC flag _should_concurrent_collect is set to false after a CMS concurrent collection.
It should probably also be cleared after a foreground CMS collection and a stop-the-world full collection.
8064702 removed the option to do a foreground CMS collection (collection that did all the parts of a concurrent CMS collection but in a STW pause).
1) A concurrent collection is requested (setting of the _should_concurrent_collect flag) and then an expand_and_allocate() call is made to satisfy the allocation.
2) If the expand_and_allocate() fails a STW full GC is done and the allocation is retried. The _should_concurrent_collect flag is not cleared here.
3) If the STW full GC does not free up enough space for the allocation a last-ditch GC is done (the fixed added for 8025635).
When a concurrent CMS collection is started, it can finish as a foreground GC. The _should_concurrent_collect flag should be cleared here as well as after a STW full GC. Consider whether that clearing can be put into the gc_epilogue() for ConcurrentMarkSweepGeneration.