Subject: bug#22814: 25.0.91; Emacs runs out of file descriptors on OS X

From: Anders Lindgren <[email-masked]>
Date: Fri, 26 Feb 2016 21:51:09 +0100

Hi!

>>> You are using "global-auto-revert-mode: t". kqueue does not support a
>>> directory monitor, therefore it starts a new file notification monitor
>>> for every single file, indeed.
>>>
>>> I believe it is questionable to run auto-revert-mode for so many files,
>>> but that's your choice. In order to suppress kqueue running for
>>> auto-revert-mode, you shall set auto-revert-use-notify to nil.
>>>
>>> Maybe there are means in OS X to increase the number of file descriptors
>>> for Emacs, don't know. I don't use OS X.
>>>
>>> I will add a note to the Emacs manual.
>>
>> I suggest adding this to etc/PROBLEMS as well.
>
> Done. Closing the bug.

Unfortunately, I don't think this is enough.

If Emacs hangs because the file notification system runs out of resources
(file descriptors or processes), it should detect this by itself and revert
to other, safer, methods (e.g. the timer-based system).

One simple way to handle this is to define a variable with "max" number of
files the notification system can handle. We can set this to, say, 200 on
OS X and unlimited on other systems.

I would suggest leaving the bug open until someone figures out how to
increase the resources in OS X, or the file notification system can handle
that it runs out of resources.

    -- Anders Lindgren