[OE-core] [PATCH 2/2] rpm: Assume a max limit of 1024 open files

Alexander Kanavin alexander.kanavin at linux.intel.com
Fri May 11 15:27:42 UTC 2018


On 05/11/2018 01:39 PM, Peter Kjellerstedt wrote:
> However, I gave this some more thought, and maybe it would be better to
> let bitbake set the soft limit for max open files to, e.g., 1024. That
> way we would not need to modify the code in rpm as it would adapt itself
> automatically. I tried adding the following to bitbake_main and it worked:
> 
>      import resource
> 
>      # Set the maximum number of open files as there are performance problems
>      # with, e.g., rpm if this is unlimited (which it may be if running inside
>      # a Docker container).
>      (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE)
>      soft = int(os.environ.get("BB_LIMIT_NOFILE", "1024"))
>      resource.setrlimit(resource.RLIMIT_NOFILE, (min(soft, hard), hard))

That's right, this is the best solution.

Alex



More information about the Openembedded-core mailing list