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 Bug: 206336727 Test: Presubmit Change-Id: I00521a5561d98f2df6f52443b9e23025faeaeb3c
This commit is contained in:
@@ -11910,6 +11910,15 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
// If this is a preceding instance of another process instance
|
||||
allowRestart = mProcessList.handlePrecedingAppDiedLocked(app);
|
||||
|
||||
// If somehow this process was still waiting for the death of its predecessor,
|
||||
// (probably it's "killed" before starting for real), reset the bookkeeping.
|
||||
final ProcessRecord predecessor = app.mPredecessor;
|
||||
if (predecessor != null) {
|
||||
predecessor.mSuccessor = null;
|
||||
predecessor.mSuccessorStartRunnable = null;
|
||||
app.mPredecessor = null;
|
||||
}
|
||||
|
||||
// If the caller is restarting this app, then leave it in its
|
||||
// current lists and let the caller take care of it.
|
||||
if (restarting) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user