summaryrefslogtreecommitdiff
path: root/services/java/com
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2019-12-05 16:41:59 -0800
committerJosh Gao <jmgao@google.com>2020-01-28 18:10:55 -0800
commit679f3e4242b8e018eb7df90ef433f81088a64fff (patch)
treed8903348ee0fc352005bb8ec82e94b110897220d /services/java/com
parent88d4019b826d874b5e9b08b6005a275f33ca6fa2 (diff)
Enable fdtrack in system_server.
Spawn a thread that monitors the current fd count, and enables fdtrack to hunt down leaks when it gets too high. Bug: http://b/140703823 Test: setprop persist.sys.debug.fdtrack_enable_threshold; stop; start; logcat -c; killall -39 system_server; logcat -d | grep fdtrack Change-Id: If5831f57d47e6958112abced181f07e18e6a7261
Diffstat (limited to 'services/java/com')
-rw-r--r--services/java/com/android/server/SystemServer.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index c56634146c7b..b93365ad0ad5 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -353,6 +353,12 @@ public final class SystemServer {
*/
private static native void initZygoteChildHeapProfiling();
+
+ /**
+ * Spawn a thread that monitors for fd leaks.
+ */
+ private static native void spawnFdLeakCheckThread();
+
/**
* The main entry point from zygote.
*/
@@ -484,6 +490,11 @@ public final class SystemServer {
initZygoteChildHeapProfiling();
}
+ // Debug builds - spawn a thread to monitor for fd leaks.
+ if (Build.IS_DEBUGGABLE) {
+ spawnFdLeakCheckThread();
+ }
+
// Check whether we failed to shut down last time we tried.
// This call may not return.
performPendingShutdown();