Subject: Re: bug#40023: 26.3 Emacs crashes when creating process if many file handles are in use (e.g., when using ccls)

From: Mattias Engdegård <[email-masked]>
Date: Tue, 14 Apr 2020 18:02:47 +0200

14 apr. 2020 kl. 15.58 skrev Robert Pluim <[email-masked]>:

> With lsp-mode I think itʼs one fd per directory containing a monitored
> file, but either way itʼs a limitation, and one that people are
> running into.

Are you sure? In contrast to inotify, kqueue can't detect changes to the contents of files (or to their inodes) by monitoring their containing directory.

> - the patch from
>  <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40023#32>, which
>  reduces RLIMIT_NOFILE to FD_SETSIZE.

It's perhaps the least bad option for emacs-27. In addition to the file monitoring requirement, there's the concern that the macOS libs raise RLIMIT_NOFILE for reasons of their own, and that more things will break when they no longer get what they want.

> - select() -> poll(). GNU/Linux, macOS and *BSD all have poll, plus
>  thereʼs a gnulib module for it that we could perhaps use on
>  MS-Windows. As Eli says, not a small change.

Right. macOS doesn't have ppoll but Emacs doesn't seem to make any use of the sigmask argument.

> (increasing FD_SETSIZE is a no-go: it works on macOS, maybe on *BSD,
> and is on very shaky standards-compliance ground).

Agreed.