summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-06-02 07:46:45 +0200
committerJürg Billeter <j@bitron.ch>2020-06-03 13:49:39 +0200
commit2979229696cb83eef925a34cedcf56856f69b080 (patch)
tree99cfbbecba7be06199dcadd63df3faf89af8f8f8
parentbe13a5c2d791de6258799e22692a6e2d1af5e7be (diff)
downloadbuildstream-2979229696cb83eef925a34cedcf56856f69b080.tar.gz
_platform: Drop maximize_open_file_limit()
Without the SafeHardlinks FUSE filesystem there is no longer a need to increase the open file limit.
-rw-r--r--src/buildstream/_platform/darwin.py24
-rw-r--r--src/buildstream/_platform/platform.py17
-rw-r--r--src/buildstream/_platform/win32.py23
3 files changed, 0 insertions, 64 deletions
diff --git a/src/buildstream/_platform/darwin.py b/src/buildstream/_platform/darwin.py
index fc9be342f..00bca2c4c 100644
--- a/src/buildstream/_platform/darwin.py
+++ b/src/buildstream/_platform/darwin.py
@@ -15,36 +15,12 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
-import resource
-
from ..sandbox import SandboxDummy
from .platform import Platform
class Darwin(Platform):
-
- # This value comes from OPEN_MAX in syslimits.h
- OPEN_MAX = 10240
-
- def maximize_open_file_limit(self):
- # Note that on Mac OSX, you may not be able to simply set the soft
- # limit to the reported hard limit, as it may not be the only limit in
- # effect. The output of these commands may be somewhat independent:
- #
- # $ launchctl limit
- # $ sysctl -a | grep files
- #
- # The OPEN_MAX value from syslimits.h seems to be fairly safe, although
- # users may tweak their individual systems to have different values.
- # Without a way to determine what the real limit is, we risk failing to
- # increase the limit. Perhaps the complication is why psutil does not
- # support rlimit on Mac.
- #
- old_soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
- soft_limit = min(max(self.OPEN_MAX, old_soft_limit), hard_limit)
- resource.setrlimit(resource.RLIMIT_NOFILE, (soft_limit, hard_limit))
-
@staticmethod
def _check_dummy_sandbox_config(config):
pass
diff --git a/src/buildstream/_platform/platform.py b/src/buildstream/_platform/platform.py
index d0debfc7b..84d1fb231 100644
--- a/src/buildstream/_platform/platform.py
+++ b/src/buildstream/_platform/platform.py
@@ -39,7 +39,6 @@ class Platform:
# force_sandbox (bool): Force bst to use a particular sandbox
#
def __init__(self, force_sandbox=None):
- self.maximize_open_file_limit()
self._local_sandbox = None
self.dummy_reasons = []
self._setup_sandbox(force_sandbox)
@@ -248,22 +247,6 @@ class Platform:
"Platform {platform} does not implement check_sandbox_config()".format(platform=type(self).__name__)
)
- def maximize_open_file_limit(self):
- # Need to set resources for _frontend/app.py as this is dependent on the platform
- # SafeHardlinks FUSE needs to hold file descriptors for all processes in the sandbox.
- # Avoid hitting the limit too quickly, by increasing it as far as we can.
-
- # Import this late, as it is not available on Windows. Note that we
- # could use `psutil.Process().rlimit` instead, but this would introduce
- # a dependency on the `prlimit(2)` call, which seems to only be
- # available on Linux. For more info:
- # https://github.com/giampaolo/psutil/blob/cbf2bafbd33ad21ef63400d94cb313c299e78a45/psutil/_psutil_linux.c#L45
- import resource
-
- soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
- if soft_limit != hard_limit:
- resource.setrlimit(resource.RLIMIT_NOFILE, (hard_limit, hard_limit))
-
def _setup_dummy_sandbox(self):
raise ImplError(
"Platform {platform} does not implement _setup_dummy_sandbox()".format(platform=type(self).__name__)
diff --git a/src/buildstream/_platform/win32.py b/src/buildstream/_platform/win32.py
index 33645e030..5045c9e3e 100644
--- a/src/buildstream/_platform/win32.py
+++ b/src/buildstream/_platform/win32.py
@@ -20,29 +20,6 @@ from .platform import Platform
class Win32(Platform):
- def maximize_open_file_limit(self):
- # Note that on Windows, we don't have the 'resource' module to help us
- # configure open file limits.
- #
- # 'psutil' provides an rlimit implementation that is only available on
- # Linux, as of version 5.3.
- #
- # Given that this limit is only important for SafeHardLinks FUSE, and
- # we don't have FUSE on Windows, this won't be an obstacle for now.
- #
- # If it does turn out to be an obstacle, beware that the Windows API
- # `_setmaxstdio` for increasing the open file limit only applies to the
- # 'stream I/O level', i.e. `fopen()` and friends. CPython opens files
- # using `_wopen()`, which is at the 'low I/O level'.
- #
- # You can see this in the function `os_open_impl` in `posixmodule.c` in
- # CPython version 3.9.
- #
- # For more information:
- # https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio
- #
- pass
-
@staticmethod
def _check_dummy_sandbox_config(config):
pass