6983311: G1: LoopTest hangs when run with -XX:+ExplicitInvokesConcurrent

Clear the concurrent marking "in progress" flag while the FullGCCount_lock is held. This avoids a race that can cause back to back System.gc() calls, when ExplicitGCInvokesConcurrent is enabled, to fail to initiate a marking cycle causing the requesting thread to hang.

Reviewed-by: tonyp, ysr
This commit is contained in:
John Cuthbertson 2010-10-01 18:23:16 -07:00
parent 603e50f355
commit 20289fbffd
3 changed files with 14 additions and 5 deletions

View file

@ -303,9 +303,10 @@ void ConcurrentMarkThread::print_on(outputStream* st) const {
}
void ConcurrentMarkThread::sleepBeforeNextCycle() {
clear_in_progress();
// We join here because we don't want to do the "shouldConcurrentMark()"
// below while the world is otherwise stopped.
assert(!in_progress(), "should have been cleared");
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
while (!started()) {
CGC_lock->wait(Mutex::_no_safepoint_check_flag);