Foreground collector becomes active when the coordinator is in a yield loop.
for (unsigned i = 0; i < CMSCoordinatorYieldSleepCount &&
ConcurrentMarkSweepThread::should_yield(); ++i) {
assert(!CMSCollector::foregroundGCIsActive() , "can't become true "
"while there are pending unsatisfied yield requests");
os::sleep(Thread::current(), 1, false);
}
The assertion in the code above detects this condition.
The test case and the backtraces from all the threads attached.
The command line for the test is: java -server -Xmixed -DHANGINGJAVA27879 -XX:-PrintVMOptions -Xincgc -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled gc.gctests.FinalizerGC01.FinalizerGC01