diff options
author | Mathieu Chartier <mathieuc@google.com> | 2016-07-13 09:53:35 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2016-07-27 14:37:42 -0700 |
commit | a704eda0078989a73cac111ed309aca50d2e289b (patch) | |
tree | 07fd076b3ea6f86bfea71e4c6707fd301f108db5 /disassembler/disassembler_mips.cc | |
parent | 9755c262df1be7f5d5b98d038c8fd3734e974f9d (diff) |
Use try lock to fix class resolution race
There was some possible deadlocks related to EnsureResolved caused by
acquiring an object lock.
Scenario:
Thread 1 acquires lock on obj1
Thread 1 begins to resolve / initialize class1
Thread 1 blocks since it sees that class1 is already being resolved and
gets preempted before it can acquire the object lock on class1
Thread 2 finishes resolving and initializing class1 and locks class1
Thread 2 blocks attempting to lock obj1
Thread 1 blocks attempting to lock class1
Deadlock
Fixed the deadlock by changing EnsureResolved to use a try lock for the
unresolved case.
Added a test.
Test: Device boot, test-art-host, monitor_test
Bug: 27417671
Change-Id: Ic6e1c3ca6f45490cf8a7bf8e137dee71ac83ff64
Diffstat (limited to 'disassembler/disassembler_mips.cc')
0 files changed, 0 insertions, 0 deletions