diff options
| author | 2021-05-04 16:21:58 -0700 | |
|---|---|---|
| committer | 2021-05-04 16:21:58 -0700 | |
| commit | 2046d54ed660875914835d1c5d807faa1ccf1330 (patch) | |
| tree | 299727b2a2f0e64feed5de97cfa6e6c1e2509d9e | |
| parent | c4520f1398405a406dcb57f7ac7ab8744b546f8f (diff) | |
Kill logcat with SEGV so we get a tombstone on timeout.
Looking at the history of this code, we've had hard to reproduce issues
here since at least 2016. The most recent bug doesn't even have any
information to let us work out whether the problem is with logcat, with
timeout, or with the Java code calling them. Let's use SIGSEGV so we'll
at least have a tombstone if timeout has to kill logcat.
Bug: http://b/187005648
Test: treehugger
Change-Id: I224555c631d784647dafc30641c2c8a447884971
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 2744f11f1c4e..5122be2b10c4 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -10272,11 +10272,13 @@ public class ActivityManagerService extends IActivityManager.Stub if (lines > 0) { sb.append("\n"); - // Merge several logcat streams, and take the last N lines InputStreamReader input = null; try { java.lang.Process logcat = new ProcessBuilder( - "/system/bin/timeout", "-k", "15s", "10s", + // Time out after 10s, but kill logcat with SEGV + // so we can investigate why it didn't finish. + "/system/bin/timeout", "-s", "SEGV", "10s", + // Merge several logcat streams, and take the last N lines. "/system/bin/logcat", "-v", "threadtime", "-b", "events", "-b", "system", "-b", "main", "-b", "crash", "-t", String.valueOf(lines)) .redirectErrorStream(true).start(); |