am 82975e40: Merge "Emit a more meaningful cause for watchdog restarts." into klp-dev
* commit '82975e40083b86d2619ffa60ff7351928ec35978': Emit a more meaningful cause for watchdog restarts.
This commit is contained in:
@@ -129,7 +129,12 @@ public class Watchdog extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String describeBlockedStateLocked() {
|
public String describeBlockedStateLocked() {
|
||||||
return mCurrentMonitor == null ? mName : mCurrentMonitor.getClass().getName();
|
if (mCurrentMonitor == null) {
|
||||||
|
return "Blocked in handler on " + mName + " (" + getThread().getName() + ")";
|
||||||
|
} else {
|
||||||
|
return "Blocked in monitor " + mCurrentMonitor.getClass().getName()
|
||||||
|
+ " on " + mName + " (" + getThread().getName() + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -291,7 +296,7 @@ public class Watchdog extends Thread {
|
|||||||
boolean waitedHalf = false;
|
boolean waitedHalf = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
final ArrayList<HandlerChecker> blockedCheckers;
|
final ArrayList<HandlerChecker> blockedCheckers;
|
||||||
final String name;
|
final String subject;
|
||||||
final boolean allowRestart;
|
final boolean allowRestart;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
long timeout = TIME_TO_WAIT;
|
long timeout = TIME_TO_WAIT;
|
||||||
@@ -336,14 +341,14 @@ public class Watchdog extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blockedCheckers = getBlockedCheckersLocked();
|
blockedCheckers = getBlockedCheckersLocked();
|
||||||
name = describeCheckersLocked(blockedCheckers);
|
subject = describeCheckersLocked(blockedCheckers);
|
||||||
allowRestart = mAllowRestart;
|
allowRestart = mAllowRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got here, that means that the system is most likely hung.
|
// If we got here, that means that the system is most likely hung.
|
||||||
// First collect stack traces from all threads of the system process.
|
// First collect stack traces from all threads of the system process.
|
||||||
// Then kill this process so that the system will restart.
|
// Then kill this process so that the system will restart.
|
||||||
EventLog.writeEvent(EventLogTags.WATCHDOG, name);
|
EventLog.writeEvent(EventLogTags.WATCHDOG, subject);
|
||||||
|
|
||||||
ArrayList<Integer> pids = new ArrayList<Integer>();
|
ArrayList<Integer> pids = new ArrayList<Integer>();
|
||||||
pids.add(Process.myPid());
|
pids.add(Process.myPid());
|
||||||
@@ -379,7 +384,7 @@ public class Watchdog extends Thread {
|
|||||||
public void run() {
|
public void run() {
|
||||||
mActivity.addErrorToDropBox(
|
mActivity.addErrorToDropBox(
|
||||||
"watchdog", null, "system_server", null, null,
|
"watchdog", null, "system_server", null, null,
|
||||||
name, null, stack, null);
|
subject, null, stack, null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
dropboxThread.start();
|
dropboxThread.start();
|
||||||
@@ -396,7 +401,7 @@ public class Watchdog extends Thread {
|
|||||||
try {
|
try {
|
||||||
Binder.setDumpDisabled("Service dumps disabled due to hung system process.");
|
Binder.setDumpDisabled("Service dumps disabled due to hung system process.");
|
||||||
// 1 = keep waiting, -1 = kill system
|
// 1 = keep waiting, -1 = kill system
|
||||||
int res = controller.systemNotResponding(name);
|
int res = controller.systemNotResponding(subject);
|
||||||
if (res >= 0) {
|
if (res >= 0) {
|
||||||
Slog.i(TAG, "Activity controller requested to coninue to wait");
|
Slog.i(TAG, "Activity controller requested to coninue to wait");
|
||||||
waitedHalf = false;
|
waitedHalf = false;
|
||||||
@@ -412,7 +417,7 @@ public class Watchdog extends Thread {
|
|||||||
} else if (!allowRestart) {
|
} else if (!allowRestart) {
|
||||||
Slog.w(TAG, "Restart not allowed: Watchdog is *not* killing the system process");
|
Slog.w(TAG, "Restart not allowed: Watchdog is *not* killing the system process");
|
||||||
} else {
|
} else {
|
||||||
Slog.w(TAG, "*** WATCHDOG KILLING SYSTEM PROCESS: " + name);
|
Slog.w(TAG, "*** WATCHDOG KILLING SYSTEM PROCESS: " + subject);
|
||||||
for (int i=0; i<blockedCheckers.size(); i++) {
|
for (int i=0; i<blockedCheckers.size(); i++) {
|
||||||
Slog.w(TAG, blockedCheckers.get(i).getName() + " stack trace:");
|
Slog.w(TAG, blockedCheckers.get(i).getName() + " stack trace:");
|
||||||
StackTraceElement[] stackTrace
|
StackTraceElement[] stackTrace
|
||||||
|
|||||||
Reference in New Issue
Block a user