diff options
author | 2017-02-08 16:35:45 -0800 | |
---|---|---|
committer | 2017-02-10 16:15:01 -0800 | |
commit | a222404a5832ab16786931576d52825d08eed3ca (patch) | |
tree | 7350e5efbb6ef72c33e82753d79f7f4bed92d9d4 /runtime/gc/reference_processor.cc | |
parent | 1561de49b382627ddd277b8ad7e5e8f4cec32f0b (diff) |
Fix the empty checkpoint timeout.
The problem happens when a thread is indirectly blocked on a mutex
that another thread holds and is blocked on a weak ref access.
Add a way to do a dummy wakeup on a thread that's blocked on a mutex
so that the thread will respond to the empty checkpoint request. Do
this for the mutexes that are expected to be held when a weak ref is
accessed. Add a check that detects an unexpected case.
Bug: 33006388
Bug: 12687968
Test: test-art-host.
Change-Id: Iefec69b9a21aa25a928cb31fcf4fb872f867a8c2
Diffstat (limited to 'runtime/gc/reference_processor.cc')
-rw-r--r-- | runtime/gc/reference_processor.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc index c1548365c7..86b152211c 100644 --- a/runtime/gc/reference_processor.cc +++ b/runtime/gc/reference_processor.cc @@ -104,7 +104,7 @@ ObjPtr<mirror::Object> ReferenceProcessor::GetReferent(Thread* self, } // Check and run the empty checkpoint before blocking so the empty checkpoint will work in the // presence of threads blocking for weak ref access. - self->CheckEmptyCheckpoint(); + self->CheckEmptyCheckpointFromWeakRefAccess(Locks::reference_processor_lock_); condition_.WaitHoldingLocks(self); } return reference->GetReferent(); @@ -292,7 +292,7 @@ void ReferenceProcessor::WaitUntilDoneProcessingReferences(Thread* self) { (kUseReadBarrier && !self->GetWeakRefAccessEnabled())) { // Check and run the empty checkpoint before blocking so the empty checkpoint will work in the // presence of threads blocking for weak ref access. - self->CheckEmptyCheckpoint(); + self->CheckEmptyCheckpointFromWeakRefAccess(Locks::reference_processor_lock_); condition_.WaitHoldingLocks(self); } } |