8169423: Infinite loop in G1's ConcurrentMarkThread

Also terminate loop if has_aborted flag is set.

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Kim Barrett 2016-11-15 19:39:51 -05:00
parent 198498171b
commit 7d9d3aa1a0

View File

@ -156,9 +156,7 @@ void ConcurrentMarkThread::run_service() {
jlong mark_start = os::elapsed_counter();
log_info(gc, marking)("Concurrent Mark (%.3fs)", TimeHelper::counter_to_seconds(mark_start));
int iter = 0;
do {
iter++;
for (uint iter = 1; true; ++iter) {
if (!cm()->has_aborted()) {
G1ConcPhaseTimer t(_cm, "Concurrent Mark From Roots");
_cm->mark_from_roots();
@ -178,11 +176,14 @@ void ConcurrentMarkThread::run_service() {
VM_CGC_Operation op(&final_cl, "Pause Remark");
VMThread::execute(&op);
}
if (cm()->restart_for_overflow()) {
log_debug(gc, marking)("Restarting Concurrent Marking because of Mark Stack Overflow in Remark (Iteration #%d).", iter);
log_info(gc, marking)("Concurrent Mark Restart due to overflow");
if (!cm()->restart_for_overflow() || cm()->has_aborted()) {
break;
}
} while (cm()->restart_for_overflow());
log_info(gc, marking)("Concurrent Mark Restart due to overflow"
" (iteration #%u", iter);
}
if (!cm()->has_aborted()) {
G1ConcPhaseTimer t(_cm, "Concurrent Create Live Data");