changeset 54654:d68e38b01cf0

8217794: Missing termination check results violation of termination invariant Reviewed-by: tschatzl, shade
author zgu
date Tue, 29 Jan 2019 12:12:27 -0500
parents 0f5fd67d0886
children 005bcf879e09
files src/hotspot/share/gc/shared/owstTaskTerminator.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);