summaryrefslogtreecommitdiff
path: root/runtime/native/dalvik_system_VMStack.cc
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2022-10-13 02:47:24 +0000
committer Hans Boehm <hboehm@google.com> 2022-10-13 02:47:24 +0000
commitebd76406bf5fa74185998bc29f0f27c20fa2e683 (patch)
treebeec1accc089bbbc432a140dfebe28bb7278a909 /runtime/native/dalvik_system_VMStack.cc
parentfd20a745227aa7cae7a08728bb29e5bfce64ea87 (diff)
Revert "Revert^2 "Thread suspension cleanup and deadlock fix""
This reverts commit fd20a745227aa7cae7a08728bb29e5bfce64ea87. Reason for revert: Lots of libartd failures due to new checkpoint lock level check. Change-Id: I0cf88ff893f8743a9a830a49489807d0921199a3
Diffstat (limited to 'runtime/native/dalvik_system_VMStack.cc')
-rw-r--r--runtime/native/dalvik_system_VMStack.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index 7b21de204d..71078c9ad2 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -57,7 +57,10 @@ static ResultT GetThreadStack(const ScopedFastNativeObjectAccess& soa,
// Suspend thread to build stack trace.
ScopedThreadSuspension sts(soa.Self(), ThreadState::kNative);
ThreadList* thread_list = Runtime::Current()->GetThreadList();
- Thread* thread = thread_list->SuspendThreadByPeer(peer, SuspendReason::kInternal);
+ bool timed_out;
+ Thread* thread = thread_list->SuspendThreadByPeer(peer,
+ SuspendReason::kInternal,
+ &timed_out);
if (thread != nullptr) {
// Must be runnable to create returned array.
{
@@ -67,6 +70,9 @@ static ResultT GetThreadStack(const ScopedFastNativeObjectAccess& soa,
// Restart suspended thread.
bool resumed = thread_list->Resume(thread, SuspendReason::kInternal);
DCHECK(resumed);
+ } else if (timed_out) {
+ LOG(ERROR) << "Trying to get thread's stack failed as the thread failed to suspend within a "
+ "generous timeout.";
}
}
return trace;