Unlock suspend count lock before dumping threads
We're seeing apparent deadlocks on thread_suspend_count_lock_
when failing to suspend a thread. These do not appear to be real
since thread_suspend_cound_lock_ is only briefly held here. By
releasing the lock before dumping threads and crashing, we
hope to get better information on where we're actually stuck.
Test: Treehugger
Bug: 203363895
Change-Id: I68879cfc6f527c702831b0dfd407b432d10c39c8
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index f50dba8..e9f86d8 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -969,6 +969,9 @@
LOG(WARNING) << "Suspended thread state_and_flags: "
<< suspended_thread->StateAndFlagsAsHexString()
<< ", self_suspend_count = " << self_suspend_count;
+ // Explicitly release thread_suspend_count_lock_; we haven't held it for long, so
+ // seeing threads blocked on it is not informative.
+ Locks::thread_suspend_count_lock_->Unlock(self);
ThreadSuspendByPeerWarning(self,
::android::base::FATAL,
"Thread suspension timed out",