summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2015-04-13 17:04:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-13 17:04:58 +0000
commitfac107bdddb5f2370f762e55a89847570e901245 (patch)
treeafde3114490d3deceee2be122f69a84528a5e972 /runtime/jdwp
parenta4c7aa2ba0485c2c876107ca6e1ce1f835ae23be (diff)
parent692063955ae845d8bd9fa2d22a50a1e06513bdcf (diff)
downloadart-fac107bdddb5f2370f762e55a89847570e901245.zip
art-fac107bdddb5f2370f762e55a89847570e901245.tar.gz
art-fac107bdddb5f2370f762e55a89847570e901245.tar.bz2
Merge "JDWP: fix thread_list deadlock"
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/object_registry.cc4
-rw-r--r--runtime/jdwp/object_registry.h12
2 files changed, 13 insertions, 3 deletions
diff --git a/runtime/jdwp/object_registry.cc b/runtime/jdwp/object_registry.cc
index 99a005d..a42a58f 100644
--- a/runtime/jdwp/object_registry.cc
+++ b/runtime/jdwp/object_registry.cc
@@ -50,6 +50,10 @@ JDWP::ObjectId ObjectRegistry::InternalAdd(mirror::Object* o) {
Thread* const self = Thread::Current();
self->AssertNoPendingException();
+ // Object::IdentityHashCode may cause these locks to be held so check we do not already
+ // hold them.
+ Locks::thread_list_lock_->AssertNotHeld(self);
+ Locks::thread_suspend_count_lock_->AssertNotHeld(self);
StackHandleScope<1> hs(self);
Handle<mirror::Object> obj_h(hs.NewHandle(o));
diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h
index 0693f33..27a4e55 100644
--- a/runtime/jdwp/object_registry.h
+++ b/runtime/jdwp/object_registry.h
@@ -62,9 +62,13 @@ class ObjectRegistry {
ObjectRegistry();
JDWP::ObjectId Add(mirror::Object* o)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_);
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ LOCKS_EXCLUDED(Locks::thread_list_lock_,
+ Locks::thread_suspend_count_lock_);
JDWP::RefTypeId AddRefType(mirror::Class* c)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::thread_list_lock_);
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+ LOCKS_EXCLUDED(Locks::thread_list_lock_,
+ Locks::thread_suspend_count_lock_);
template<typename T> T Get(JDWP::ObjectId id, JDWP::JdwpError* error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -96,7 +100,9 @@ class ObjectRegistry {
private:
JDWP::ObjectId InternalAdd(mirror::Object* o)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
- LOCKS_EXCLUDED(lock_, Locks::thread_list_lock_);
+ LOCKS_EXCLUDED(lock_,
+ Locks::thread_list_lock_,
+ Locks::thread_suspend_count_lock_);
mirror::Object* InternalGet(JDWP::ObjectId id, JDWP::JdwpError* error)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)