8217794: Missing termination check results violation of termination invariant
Reviewed-by: tschatzl, shade
--- a/src/hotspot/share/gc/shared/owstTaskTerminator.cpp Tue Jan 29 11:56:51 2019 -0500
+++ b/src/hotspot/share/gc/shared/owstTaskTerminator.cpp Tue Jan 29 12:12:27 2019 -0500
@@ -65,6 +65,13 @@
return true;
} else {
_blocker->lock_without_safepoint_check();
+ // There is possibility that termination is reached between dropping the lock
+ // before returning from do_spin_master_work() and acquiring lock above.
+ if (_offered_termination == _n_threads) {
+ _blocker->unlock();
+ assert(!peek_in_queue_set(), "Precondition");
+ return true;
+ }
}
} else {
_blocker->wait(true, WorkStealingSleepMillis);