ART: log threads not suspending in SuspendAllInternal
Unisoc bug #936294 add log to print thread
[root cause ] add log to print thread
[changes ] add log to print thread
[side effects]no
[self test ]:yes
[download normally]:yes
[power on/off normally]:yes
[do common repository/branch inspection]:yes
[is there dependence]:no
[confirm dependent commit]:no
[board]:sharkle
[test case]:monkey
[reviewers ] cheney.chen
[change_type ] debug_log
[tag_product ] common
Unisoc_Owner: Jasson.Zhang@unisoc.com
Test: make libart
Bug: 121370289
Change-Id: If4c4b94d60ad03d1641694e859b217b41c74cf9e
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 4bbd81a..75462ac 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -766,15 +766,29 @@
#if ART_USE_FUTEXES
if (futex(pending_threads.Address(), FUTEX_WAIT_PRIVATE, cur_val, &wait_timeout, nullptr, 0)
!= 0) {
- // EAGAIN and EINTR both indicate a spurious failure, try again from the beginning.
- if ((errno != EAGAIN) && (errno != EINTR)) {
- if (errno == ETIMEDOUT) {
- LOG(kIsDebugBuild ? ::android::base::FATAL : ::android::base::ERROR)
- << "Timed out waiting for threads to suspend, waited for "
- << PrettyDuration(NanoTime() - start_time);
- } else {
- PLOG(FATAL) << "futex wait failed for SuspendAllInternal()";
+ if ((errno == EAGAIN) || (errno == EINTR)) {
+ // EAGAIN and EINTR both indicate a spurious failure, try again from the beginning.
+ continue;
+ }
+ if (errno == ETIMEDOUT) {
+ const uint64_t wait_time = NanoTime() - start_time;
+ MutexLock mu(self, *Locks::thread_list_lock_);
+ MutexLock mu2(self, *Locks::thread_suspend_count_lock_);
+ std::ostringstream oss;
+ for (const auto& thread : list_) {
+ if (thread == ignore1 || thread == ignore2) {
+ continue;
+ }
+ if (!thread->IsSuspended()) {
+ oss << std::endl << "Thread not suspended: " << *thread;
+ }
}
+ LOG(kIsDebugBuild ? ::android::base::FATAL : ::android::base::ERROR)
+ << "Timed out waiting for threads to suspend, waited for "
+ << PrettyDuration(wait_time)
+ << oss.str();
+ } else {
+ PLOG(FATAL) << "futex wait failed for SuspendAllInternal()";
}
} // else re-check pending_threads in the next iteration (this may be a spurious wake-up).
#else