Avoid deadlock.
dvmIsHeapAddress is the pointer validity checker for use outside the GC. If
it doesn't take the heap lock, it risks looking at data structures that are
changing under its feet. If it does take the heap lock, it risks deadlock
between a thread doing an explicit GC and the signal catcher trying to dump
threads (causing the GC thread to be suspended while holding the heap lock).
Calling back into managed code while holding the heap lock and with other
threads resumed sounds like an inherently bad idea to me, but that's a battle
for another day.
With this change, we can handle SIGQUIT while we're in ReferenceQueue.add
as a result of an explicit GC in a system doing concurrent collections, so
the only known problem is fixed.
Bug: 5425802
Change-Id: I42d434d5ea3ffbcb77a4c544b81b08a4c7364a16
2 files changed