From 8bc6a58df7046b4d6f4b51eb274c7e60fea396ff Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Tue, 19 Dec 2023 18:48:15 +0000 Subject: Revert^17 "Thread suspension cleanup and deadlock fix" This reverts commit c6371b52df0da31acc174a3526274417b7aac0a7. Reason for revert: This seems to have two remaining issues: 1. The second DCHECK in WaitForFlipFunction is not completely guaranteed to hold, resulting in failures for 658-fp-read-barrier. 2. WaitForSuspendBarrier seems to time out occasionally, possibly spuriously so. We fail when the futex times out once. That's probably incompatible with the app freezer. We should retry a few times. Change-Id: Ibd8909b31083fc29e6d4f1fcde003d08eb16fc0a --- openjdkjvmti/ti_object.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'openjdkjvmti/ti_object.cc') diff --git a/openjdkjvmti/ti_object.cc b/openjdkjvmti/ti_object.cc index 3333a8a834..f37df86048 100644 --- a/openjdkjvmti/ti_object.cc +++ b/openjdkjvmti/ti_object.cc @@ -105,17 +105,13 @@ jvmtiError ObjectUtil::GetObjectMonitorUsage( notify_wait.push_back(jni->AddLocalReference(thd->GetPeerFromOtherThread())); wait.push_back(jni->AddLocalReference(thd->GetPeerFromOtherThread())); } - // Scan all threads to see which are waiting on this particular monitor. - std::list thread_list; { - // Since we're in a SuspendAll, exiting threads are not a concern. + // Scan all threads to see which are waiting on this particular monitor. art::MutexLock tll(self, *art::Locks::thread_list_lock_); - thread_list = art::Runtime::Current()->GetThreadList()->GetList(); - } - for (art::Thread* thd : thread_list) { - if (thd != info.owner_ && target.Ptr() == thd->GetMonitorEnterObject()) { - art::mirror::Object* peer = thd->GetPeerFromOtherThread(); - wait.push_back(jni->AddLocalReference(peer)); + for (art::Thread* thd : art::Runtime::Current()->GetThreadList()->GetList()) { + if (thd != info.owner_ && target.Ptr() == thd->GetMonitorEnterObject()) { + wait.push_back(jni->AddLocalReference(thd->GetPeerFromOtherThread())); + } } } } -- cgit v1.2.3-59-g8ed1b