OSDN Git Service

Increase thread suspension timeout for debug builds
authorMathieu Chartier <mathieuc@google.com>
Wed, 11 Jan 2017 18:09:30 +0000 (10:09 -0800)
committerMathieu Chartier <mathieuc@google.com>
Wed, 11 Jan 2017 18:36:57 +0000 (10:36 -0800)
The current timeout may be causing some test failures. Also print how
long we waited.

Test: test-art-host -j32

Change-Id: Ib8a9c68ab4571efc8456c098b03bf35f648bfaf1

runtime/thread_list.cc

index 34f9043..c5c7e2c 100644 (file)
@@ -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);