From 4d992437eba9252a96235418c1c8564876f952d8 Mon Sep 17 00:00:00 2001 From: Sylvain Defresne Date: Wed, 26 Jul 2023 23:09:06 +0000 Subject: [PATCH] [apple] Set limit of 200 process when running on macOS Ventura 13.5 The limit set in /Library/LaunchDaemons/limit.maxfiles.plist appears to no longer be respected in macOS Ventura 13.5 and the OS forces a limit of 256 file descriptors, causing build with autoninja to fail on macOS running this most recent version of the OS. Force the max number of process to 200 until a new working way to increase the file descriptor limit is found. This will allow devs working on macOS to be able to build (albeit slower than before). Fixes the following build failure when goma is enabled and running on macOS Ventura 13.5: $ autoninja -C out/Debug-iphonesimulator chrome ninja: Entering directory `out/Debug-iphonesimulator' [0/3574] CXX ....oninja: fatal: pipe: Too many open files Bug: 1467777 Change-Id: Ia7eaab552f7e6d26a2f48d72bb8235a70d6d442f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4720227 Reviewed-by: Dirk Pranke Auto-Submit: Sylvain Defresne Commit-Queue: Dirk Pranke --- autoninja.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/autoninja.py b/autoninja.py index 6f45af28c8..7c1cf60d44 100755 --- a/autoninja.py +++ b/autoninja.py @@ -181,9 +181,17 @@ def main(args): # performance. j_value = min(j_value, 1000) elif sys.platform == 'darwin': - # On macOS, j value higher than 800 causes 'Too many open files' error - # (crbug.com/936864). - j_value = min(j_value, 800) + mac_ver = tuple(map(int, platform.mac_ver()[0].split('.'))) + if mac_ver[0] > 13 or (mac_ver[0] == 13 and mac_ver[0] >= 5): + # On macOS 13.5, the recommended way to increase the file descriptors + # and process no longer works and the build fails with an error. Set + # the limit to 200 until new way to increase the limit is discovered + # (crbug.com/1467777). + j_value = min(j_value, 250) + else: + # On macOS, j value higher than 800 causes 'Too many open files' error + # (crbug.com/936864). + j_value = min(j_value, 800) args.append('%d' % j_value) else: