summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-01-11 10:09:30 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-01-11 10:36:57 -0800
commit32c8337f9fcb8e7026b7ee67dc4ff3e1ca74830e (patch)
tree54b1f794ae537ed43b1bedf560bfd992b3b3697a
parenta28ddf5140cd1f4a2ae93dbf8be2f200b1552003 (diff)
Increase thread suspension timeout for debug builds
The current timeout may be causing some test failures. Also print how long we waited. Test: test-art-host -j32 Change-Id: Ib8a9c68ab4571efc8456c098b03bf35f648bfaf1
-rw-r--r--runtime/thread_list.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 34f9043792..c5c7e2cc16 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -653,8 +653,9 @@ void ThreadList::SuspendAllInternal(Thread* self,
// is done with a timeout so that we can detect problems.
#if ART_USE_FUTEXES
timespec wait_timeout;
- InitTimeSpec(false, CLOCK_MONOTONIC, 10000, 0, &wait_timeout);
+ InitTimeSpec(false, CLOCK_MONOTONIC, kIsDebugBuild ? 50000 : 10000, 0, &wait_timeout);
#endif
+ const uint64_t start_time = NanoTime();
while (true) {
int32_t cur_val = pending_threads.LoadRelaxed();
if (LIKELY(cur_val > 0)) {
@@ -664,7 +665,8 @@ void ThreadList::SuspendAllInternal(Thread* self,
if ((errno != EAGAIN) && (errno != EINTR)) {
if (errno == ETIMEDOUT) {
LOG(kIsDebugBuild ? ::android::base::FATAL : ::android::base::ERROR)
- << "Unexpected time out during suspend all.";
+ << "Timed out waiting for threads to suspend, waited for "
+ << PrettyDuration(NanoTime() - start_time);
} else {
PLOG(FATAL) << "futex wait failed for SuspendAllInternal()";
}
@@ -672,6 +674,7 @@ void ThreadList::SuspendAllInternal(Thread* self,
} // else re-check pending_threads in the next iteration (this may be a spurious wake-up).
#else
// Spin wait. This is likely to be slow, but on most architecture ART_USE_FUTEXES is set.
+ UNUSED(start_time);
#endif
} else {
CHECK_EQ(cur_val, 0);