Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
erlang
1063-Don-t-crash-if-the-number-of-file-descript...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1063-Don-t-crash-if-the-number-of-file-descriptors-is-unl.patch of Package erlang
From 667e1b04eb2e8745c23e1d6ded0fedaeae9b5c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Fri, 4 Dec 2020 08:46:45 +0100 Subject: [PATCH] Don't crash if the number of file descriptors is unlimited On macOS 11, the maximum number of file descriptors can be unlimited. `erl` refuses to start if it can't read out the limit. It is not practical for `erl` to use a huge number such as 134217728 as the default value, because that value is also used as the size of the port table. (Making the port table's size dynamic is not something we want do in a maintenance release.) Therefore we will set it to 24576, which is the value returned by `sysctl kern.maxfilesperproc`, and which seems to be the practical limit. (Raising that limit might be possible, but it can only be done by disabling System Integrity Protection (SIP) and editing a bunch of configuration files. Anyone who has done that will have to set ulimit explicitly to number of file descriptors they want to use.) https://bugs.erlang.org/browse/ERL-1417 --- erts/emulator/sys/common/erl_poll.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/erts/emulator/sys/common/erl_poll.c b/erts/emulator/sys/common/erl_poll.c index 4e5918d1be..257f7e29a0 100644 --- a/erts/emulator/sys/common/erl_poll.c +++ b/erts/emulator/sys/common/erl_poll.c @@ -2062,6 +2062,21 @@ ERTS_POLL_EXPORT(erts_poll_init)(int *concurrent_updates) max_fds = OPEN_MAX; #endif + if (max_fds < 0 && errno == 0) { + /* On macOS 11 and higher, it possible to have an unlimited + * number of open files per process. ERTS will need an actual + * limit, though, so we will set it to a largish value. The + * number below is the hard number of file descriptors per + * process as returned by `sysctl kern.maxfilesperproc`, which + * seems to be the limit in practice. + * + * Note: The size of the port table will be based on max_fds, + * so we don't want to set it to a huge value such as + * MAX_INT. + */ + max_fds = 24576; + } + #if ERTS_POLL_USE_SELECT && defined(FD_SETSIZE) && \ !defined(_DARWIN_UNLIMITED_SELECT) if (max_fds > FD_SETSIZE) -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor