diff options
author | Christopher Tate <ctate@google.com> | 2013-04-16 16:08:12 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2013-04-17 10:40:02 -0700 |
commit | 1b645986020a5bd66f6783fa87b9f084c809d801 (patch) | |
tree | 49d769a83151d8a7c6a527cef6263c08f38d2b10 /services/java | |
parent | ad435ba7fff45b8a15ebda08f88767511935a5d7 (diff) | |
download | frameworks_base-1b645986020a5bd66f6783fa87b9f084c809d801.zip frameworks_base-1b645986020a5bd66f6783fa87b9f084c809d801.tar.gz frameworks_base-1b645986020a5bd66f6783fa87b9f084c809d801.tar.bz2 |
Lengthen the AM timeout reading crash reports slightly
We're missing some (small fraction of) native crash reports from
debuggerd. It looks like under high system load the debuggerd
reporting code just isn't quite timely enough for the very short
timeouts initially deployed, so lengthen those a bit.
Bug 8552010
Change-Id: Icbc5b6517de3bb98fff1af2ea42ffd208ef20412
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/am/NativeCrashListener.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/services/java/com/android/server/am/NativeCrashListener.java b/services/java/com/android/server/am/NativeCrashListener.java index 0688c50..de439d7 100644 --- a/services/java/com/android/server/am/NativeCrashListener.java +++ b/services/java/com/android/server/am/NativeCrashListener.java @@ -43,13 +43,14 @@ import java.net.InetUnixAddress; class NativeCrashListener extends Thread { static final String TAG = "NativeCrashListener"; static final boolean DEBUG = false; + static final boolean MORE_DEBUG = DEBUG && false; // Must match the path defined in debuggerd.c. static final String DEBUGGERD_SOCKET_PATH = "/data/system/ndebugsocket"; // Use a short timeout on socket operations and abandon the connection // on hard errors - static final long SOCKET_TIMEOUT_MILLIS = 1000; // 1 second + static final long SOCKET_TIMEOUT_MILLIS = 2000; // 2 seconds final ActivityManagerService mAm; @@ -124,9 +125,9 @@ class NativeCrashListener extends Thread { InetSocketAddress peer = new InetSocketAddress(); FileDescriptor peerFd = null; try { - if (DEBUG) Slog.v(TAG, "Waiting for debuggerd connection"); + if (MORE_DEBUG) Slog.v(TAG, "Waiting for debuggerd connection"); peerFd = Libcore.os.accept(serverFd, peer); - if (DEBUG) Slog.v(TAG, "Got debuggerd socket " + peerFd); + if (MORE_DEBUG) Slog.v(TAG, "Got debuggerd socket " + peerFd); if (peerFd != null) { // Only the superuser is allowed to talk to us over this socket StructUcred credentials = @@ -145,7 +146,12 @@ class NativeCrashListener extends Thread { if (peerFd != null) { try { Libcore.os.write(peerFd, ackSignal, 0, 1); - } catch (Exception e) { /* we don't care about failures here */ } + } catch (Exception e) { + /* we don't care about failures here */ + if (MORE_DEBUG) { + Slog.d(TAG, "Exception writing ack: " + e.getMessage()); + } + } } } } @@ -183,7 +189,7 @@ class NativeCrashListener extends Thread { // Read the crash report from the debuggerd connection void consumeNativeCrashData(FileDescriptor fd) { - if (DEBUG) Slog.i(TAG, "debuggerd connected"); + if (MORE_DEBUG) Slog.i(TAG, "debuggerd connected"); final byte[] buf = new byte[4096]; final ByteArrayOutputStream os = new ByteArrayOutputStream(4096); @@ -218,7 +224,7 @@ class NativeCrashListener extends Thread { // get some data bytes = Libcore.os.read(fd, buf, 0, buf.length); if (bytes > 0) { - if (DEBUG) { + if (MORE_DEBUG) { String s = new String(buf, 0, bytes, "UTF-8"); Slog.v(TAG, "READ=" + bytes + "> " + s); } |