diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-12-19 18:41:47 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-01-06 14:12:18 -0800 |
commit | 4306ef8a7ec8e3887e51f64e80d940d974cc3ac3 (patch) | |
tree | 5afff3c97de1458886154aa5e84e1c0ae0edf11f /runtime/verifier/method_verifier.h | |
parent | d30feca670d0af02783bbdfd4a29c5078c18bdc5 (diff) | |
download | art-4306ef8a7ec8e3887e51f64e80d940d974cc3ac3.zip art-4306ef8a7ec8e3887e51f64e80d940d974cc3ac3.tar.gz art-4306ef8a7ec8e3887e51f64e80d940d974cc3ac3.tar.bz2 |
Don't allow suspension from FindLocksAtDexPc
Transitioning to suspended from runnable sometimes runs dump
checkpoints in ThreadStress which can cause deadlocks. This happens
since FindLocksAtDexPC runs the verifier which calls
AllowThreadSuspension. This results in a blocked thread which holds
the monitor lock, and if another thread tries to do a monitor enter,
it deadlocks while holding the mutator lock (assuming the GC is
suspending all).
The fix for avoiding this deadlock is not calling
AllowThreadSuspension from FindLocksAtDexPc.
Bug: 18576985
Change-Id: I7e5faaf3bbbd5b5f680de95d53c33b5106705b0c
Diffstat (limited to 'runtime/verifier/method_verifier.h')
-rw-r--r-- | runtime/verifier/method_verifier.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index 15a09c5..b83e647 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -207,10 +207,11 @@ class MethodVerifier { const DexFile::CodeItem* code_item, uint32_t method_idx, Handle<mirror::ArtMethod> method, uint32_t access_flags, bool can_load_classes, bool allow_soft_failures, - bool need_precise_constants) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) + bool need_precise_constants, bool allow_thread_suspension) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : MethodVerifier(self, dex_file, dex_cache, class_loader, class_def, code_item, method_idx, method, access_flags, can_load_classes, allow_soft_failures, - need_precise_constants, false) {} + need_precise_constants, false, allow_thread_suspension) {} ~MethodVerifier(); @@ -260,7 +261,7 @@ class MethodVerifier { const DexFile::CodeItem* code_item, uint32_t method_idx, Handle<mirror::ArtMethod> method, uint32_t access_flags, bool can_load_classes, bool allow_soft_failures, bool need_precise_constants, - bool verify_to_dump) + bool verify_to_dump, bool allow_thread_suspension) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Adds the given string to the beginning of the last failure message. @@ -729,6 +730,11 @@ class MethodVerifier { // VerifyMethodAndDump. const bool verify_to_dump_; + // Whether or not we call AllowThreadSuspension periodically, we want a way to disable this for + // thread dumping checkpoints since we may get thread suspension at an inopportune time due to + // FindLocksAtDexPC, resulting in deadlocks. + const bool allow_thread_suspension_; + DISALLOW_COPY_AND_ASSIGN(MethodVerifier); }; std::ostream& operator<<(std::ostream& os, const MethodVerifier::FailureKind& rhs); |