OSDN Git Service

Dump mutator lock for thread suspend timeout
authorMathieu Chartier <mathieuc@google.com>
Wed, 8 Oct 2014 21:26:23 +0000 (14:26 -0700)
committerMathieu Chartier <mathieuc@google.com>
Wed, 8 Oct 2014 21:26:23 +0000 (14:26 -0700)
Should help us see if thread suspend timeouts are due to someone
holding on the mutator lock for too long or if it is a missed
futex wake.

(cherry picked from commit f924d2381a5ea53967ba1e279766d601b9be05ea)

Bug: 17837911
Change-Id: I3417156a78f574076d5da17c86836c5a7c76084a

runtime/base/mutex.cc
runtime/thread_list.cc

index 4383a7c..cbcd408 100644 (file)
@@ -648,7 +648,13 @@ bool ReaderWriterMutex::IsSharedHeld(const Thread* self) const {
 void ReaderWriterMutex::Dump(std::ostream& os) const {
   os << name_
       << " level=" << static_cast<int>(level_)
-      << " owner=" << GetExclusiveOwnerTid() << " ";
+      << " owner=" << GetExclusiveOwnerTid()
+#if ART_USE_FUTEXES
+      << " state=" << state_.LoadSequentiallyConsistent()
+      << " num_pending_writers=" << num_pending_writers_.LoadSequentiallyConsistent()
+      << " num_pending_readers=" << num_pending_readers_.LoadSequentiallyConsistent()
+#endif
+      << " ";
   DumpContention(os);
 }
 
index ec5b775..53c2859 100644 (file)
@@ -199,6 +199,8 @@ static void UnsafeLogFatalForThreadSuspendAllTimeout() {
   Runtime* runtime = Runtime::Current();
   std::ostringstream ss;
   ss << "Thread suspend timeout\n";
+  Locks::mutator_lock_->Dump(ss);
+  ss << "\n";
   runtime->GetThreadList()->Dump(ss);
   LOG(FATAL) << ss.str();
   exit(0);