Don't use ScopedObjectAccess in Heap::DumpSpaces
ScopedObjectAccess does not work well if the mutator lock is
excusively held while in a suspend thread state. This caused
deadlocks and DCHECK failures.
Bug: 27493316
Change-Id: I75ab223b2d15ab4e53753f1046c580228fc1866e
diff --git a/runtime/gc/space/large_object_space.cc b/runtime/gc/space/large_object_space.cc
index e70fe21..010f677 100644
--- a/runtime/gc/space/large_object_space.cc
+++ b/runtime/gc/space/large_object_space.cc
@@ -27,6 +27,7 @@
#include "base/stl_util.h"
#include "image.h"
#include "os.h"
+#include "scoped_thread_state_change.h"
#include "space-inl.h"
#include "thread-inl.h"
@@ -190,6 +191,7 @@
MutexLock mu(self, lock_);
auto it = large_objects_.find(ptr);
if (UNLIKELY(it == large_objects_.end())) {
+ ScopedObjectAccess soa(self);
Runtime::Current()->GetHeap()->DumpSpaces(LOG(INTERNAL_FATAL));
LOG(FATAL) << "Attempted to free large object " << ptr << " which was not live";
}