all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: "Mattias Engdegård" <mattiase@acm.org>, 40023@debbugs.gnu.org
Subject: bug#40023: 26.3 Emacs crashes when creating process if many file handles are in use (e.g., when using ccls)
Date: Tue, 14 Apr 2020 15:58:51 +0200	[thread overview]
Message-ID: <m2wo6ikw2s.fsf@gmail.com> (raw)
In-Reply-To: <87pncdgg5b.fsf@gmx.de> (Michael Albinus's message of "Sun, 12 Apr 2020 12:19:44 +0200")

>>>>> On Sun, 12 Apr 2020 12:19:44 +0200, Michael Albinus <michael.albinus@gmx.de> said:

    Michael> Mattias Engdegård <mattiase@acm.org> writes:
    >> Actually reducing RLIMIT_NOFILE doesn't sound like a terrific idea --
    >> if anything, we need as many descriptors as we can get, in particular
    >> on macOS where kqueue uses up one per monitored file. If we are
    >> limited by FD_SETSIZE, then we shouldn't use select. Or am I missing
    >> something?

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.

    Michael> kqueue limits itself to (RLIMIT_NOFILE - 50) file descriptors. If 50
    Michael> file descriptors aren't sufficient, we could increase that number, or
    Michael> make it a defvar changeable via Lisp.

50 is enough. The issue is that ccls uses up the other FD_SETSIZE - 50
descriptors, and then other libraries end up passing descriptors >
FD_SETSIZE back to emacs because RLIMIT_NOFILE has been changed behind
our back.

I only see two solutions:

- the patch from
  <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40023#32>, which
  reduces RLIMIT_NOFILE to FD_SETSIZE. It works for me, but I have to
  artificially generate the crashing conditions, so some feedback from
  others would be nice (especially if we want to put it in
  emacs-27). Plus it limits the number of open file descriptors even
  on systems where crazy users want to monitor 10k files (maybe thatʼs
  a good thing :-) ).

- 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.

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

Robert





  reply	other threads:[~2020-04-14 13:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 13:50 bug#40023: 26.3; Emacs crashes when creating process if many file handles are in use (e.g., when using ccls) Holger Pirk
2020-03-11 15:32 ` Robert Pluim
2020-03-11 16:17   ` Eli Zaretskii
2020-03-11 16:45     ` Holger Pirk
2020-03-12  7:27       ` Robert Pluim
2020-03-12  7:26     ` Robert Pluim
2020-03-12 15:11       ` Eli Zaretskii
2020-03-12 15:24         ` Robert Pluim
2020-03-12 15:50           ` Eli Zaretskii
2020-03-12 16:46             ` Robert Pluim
2020-03-19 10:41               ` Robert Pluim
2020-03-19 14:36                 ` Eli Zaretskii
2020-04-11 18:15 ` bug#40023: 26.3 " Mattias Engdegård
2020-04-11 19:02   ` Eli Zaretskii
2020-04-12 10:19   ` Michael Albinus
2020-04-14 13:58     ` Robert Pluim [this message]
2020-04-14 16:02       ` Mattias Engdegård
2020-04-14 16:14         ` Robert Pluim
2020-04-14 16:23           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wo6ikw2s.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=40023@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.