Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 397b13e0 authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-team Robot
Browse files

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
(cherry picked from commit 6f29df37eda4d21f20924962571aa254863d3094)
parent ae06e159
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -8212,11 +8212,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();