Skip to content

Commit

Permalink
Add timeout for extra paranoia
Browse files Browse the repository at this point in the history
  • Loading branch information
earthling-amzn committed Sep 29, 2023
1 parent 4d62bc9 commit fbc5de1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
#include "gc/shenandoah/mode/shenandoahMode.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
#include "memory/metaspaceUtils.hpp"
#include "memory/metaspaceStats.hpp"
Expand Down Expand Up @@ -908,7 +909,10 @@ bool ShenandoahControlThread::request_concurrent_gc(ShenandoahGenerationType gen

MonitorLocker ml(&_regulator_lock, Mutex::_no_safepoint_check_flag);
while (_mode == none) {
ml.wait();
bool timeout = ml.wait(5);
if (LogTarget(Debug, gc, thread)::is_enabled() && timeout) {
log_debug(gc, thread)("Regulator thread timed out waiting for cycle to start");
}
}
return true;
}
Expand All @@ -924,7 +928,10 @@ bool ShenandoahControlThread::request_concurrent_gc(ShenandoahGenerationType gen

MonitorLocker ml(&_regulator_lock, Mutex::_no_safepoint_check_flag);
while (_mode == servicing_old) {
ml.wait();
bool timeout = ml.wait(5);
if (LogTarget(Debug, gc, thread)::is_enabled() && timeout) {
log_debug(gc, thread)("Regulator thread timed out waiting to preempt old cycle");
}
}
return true;
}
Expand Down

0 comments on commit fbc5de1

Please sign in to comment.