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

From: Robert Pluim <[email-masked]>
Date: Thu, 19 Mar 2020 11:41:37 +0100

>>>>> On Thu, 12 Mar 2020 17:46:58 +0100, Robert Pluim <[email-masked]> said:
    >>> If someone has an 'emacs -Q' testcase I can look at it. Soon we will
    >>> all be spending lots of time at home here :-(

    Eli> We could simply install the proposed workaround on the emacs-27 branch
    Eli> for now, I think.

So I installed lsp-mode and ccls, added lsp to c-mode-hook, visited
emacs/src/font.c and then said yes when it asked me if I wanted to
watch all the files (there are ~6500). I then recompiled emacs using
M-x compile, and saw no crash.

This is with emacs-master. I checked with emacs-26 and saw no crash. I
did look in *lsp-log*, and saw a bunch of messages saying:

Failed to create a watch for File watching not possible, no file descriptor left: 975: message

(this is with 'ulimit -n 4096')

so I think this is very much dependent on which language server youʼre
using. Note also that itʼs watching directories, not files, I had to
create a bunch of extra directories to get that message.

I have:

    ccls --version
    ccls version 8.0.0 (tags/RELEASE_800/final)

Robert