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

From: Holger Pirk <[email-masked]>
Date: Wed, 11 Mar 2020 16:45:45 +0000

I think it is fine if this is an open problem but I would like more graceful failure. Isn’t it possible to catch this behavior and turn it into a lisp-level error?

On 11 Mar 2020, at 16:17, Eli Zaretskii <[email-masked]<mailto:[email-masked]>> wrote:

From: Robert Pluim <[email-masked]<mailto:[email-masked]>>
Date: Wed, 11 Mar 2020 16:32:14 +0100
Cc: [email-masked]<mailto:[email-masked]>

On Wed, 11 Mar 2020 13:50:22 +0000, Holger Pirk <[email-masked]<mailto:[email-masked]>> said:

   Holger> I have spent some time digging around the code and couldn't quite figure
   Holger> out the logic behind the `fd < FD_SETSIZE`-assert. I suspect the CCLS
   Holger> opens files without going through emacs' infrastructure which leads to
   Holger> high file descriptors which emacs cannot handle. I would say that CCLS
   Holger> is, in part, to blame but emacs shouldn't simply crash.

Emacs is limited by the limits of select, which supports a maximum of
FD_SETSIZE file descriptors, which on macOS is 1024

At least on macOS, itʼs possible to increase that value to eg 8192 by
setting FD_SETSIZE, which might alleviate this, but then you'd
probably run into the 'ulimit -n' maximum, so you'd have to remember
to increase that.

Wasn't this fixed lately by Yamamoto-san?