summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-02-06 10:50:04 +0100
committerJürg Billeter <j@bitron.ch>2018-02-06 10:53:54 +0100
commit0e0990c5557f3b454f54f412d3c28c4bd4b4aaf7 (patch)
tree36ab1fbb207020dbe73d9fb9ab13c8731ba44413
parent945054df3821b7b53183983625f87c2e46fb6dd3 (diff)
downloadbuildstream-juerg/fuse-rlimit.tar.gz
Increase the soft limit for open file descriptorsjuerg/fuse-rlimit
SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox. Avoid hitting the limit too quickly by increasing the soft limit to the maximum. Fixes #232
-rw-r--r--buildstream/_frontend/main.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index fc5372048..1abbd3592 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -20,6 +20,7 @@
import os
import sys
import click
+import resource
from contextlib import contextmanager
from blessings import Terminal
from click import UsageError
@@ -778,6 +779,14 @@ class App():
else:
self.colors = False
+ # Increase the soft limit for open file descriptors to the maximum.
+ # SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
+ # Avoid hitting the limit too quickly.
+ limits = resource.getrlimit(resource.RLIMIT_NOFILE)
+ if limits[0] != limits[1]:
+ # Set soft limit to hard limit
+ resource.setrlimit(resource.RLIMIT_NOFILE, (limits[1], limits[1]))
+
#
# Initialize the main pipeline
#