From cb5fccc83c6c757f25436884e96c318f72743ffd Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 28 Aug 2017 12:53:56 -0700 Subject: [PATCH] Globally allow up to 32K FDs open per process We've seen crashes due to processes exceeding the current soft limit for open FDs of 1024, mainly due to increases in using FDs for shared memory and gralloc memory objects. There is not a compelling reason to keep this limit artificially low, so we raise it to 32K. This matches my desktop linux limit, so it is with precedent. Bug: 64894637 Test: open 32K FDs in a process without failure then fail after 32K Change-Id: Ibecfc486e9c61f273a432a108893137d2d13a530 --- rootdir/init.rc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 119954363..fb1fbd4f1 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -238,7 +238,10 @@ on init export DOWNLOAD_CACHE /data/cache # set RLIMIT_NICE to allow priorities from 19 to -20 - setrlimit 13 40 40 + setrlimit nice 40 40 + + # Allow up to 32K FDs per process + setrlimit nofile 32768 32768 # This allows the ledtrig-transient properties to be created here so # that they can be chown'd to system:system later on boot