diff options
| author | 2019-01-04 17:32:43 +0000 | |
|---|---|---|
| committer | 2019-01-04 17:32:43 +0000 | |
| commit | c93dba285a9a9cf9d84be94bd72b61fa4e3cd497 (patch) | |
| tree | 65c3a9c90715ead7cd91e25f6ba30f9c27023185 | |
| parent | 6dbf9eca35bcaa752a6758d3127c233f8b7687e3 (diff) | |
| parent | a1358e600fa9f06548298406c17a868fbf1fb095 (diff) | |
Merge "ART: log threads not suspending in SuspendAllInternal"
| -rw-r--r-- | runtime/thread_list.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 4bbd81a70d..75462ac147 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -766,15 +766,29 @@ void ThreadList::SuspendAllInternal(Thread* self, #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 |