Fix race conditions in removing dying process record

While waiting for the death of a process, if its subsequent process
record is created and killed immediately, we may end up removing
the former process record from the dying process list.

Bug: 201305599
Test: Presubmit
Change-Id: Ib62a3644d927881d7dab577b625460239e54b434
This commit is contained in:
Jing Ji
2021-11-11 12:16:58 -08:00
parent eb7f4c076f
commit b22de4e632

View File

@@ -5143,7 +5143,8 @@ public final class ProcessList {
}
Watchdog.getInstance().processDied(app.processName, app.getPid());
if (app.getDeathRecipient() == null) {
if (app.getDeathRecipient() == null
&& mDyingProcesses.get(app.processName, app.uid) == app) {
// If we've done unlinkDeathRecipient before calling into this, remove from dying list.
mDyingProcesses.remove(app.processName, app.uid);
app.setDyingPid(0);