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

From: Michael Albinus <[email-masked]>
Date: Sat, 27 Feb 2016 09:00:14 +0100

Anders Lindgren <[email-masked]> writes:

> Hi!

Hi Anders,

>> Done. Closing the bug.
>
> Unfortunately, I don't think this is enough.

I've reopened it, until we get an agreement.

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

A general support for polling in filenotify.el is not foreseen, too much
effort. But I believe, in the auto-revert case Emacs works already this
way. When file-notify-add-watch returns nil, auto-revert falls back to
polling (to be tested, I'll I add a test).

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

Would be possible, yes. I would prefer to set the limit to a system
related value. Does there exist a portable way to detect, how many file
descriptors / processes Emacs is able to consume?

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

Done, see above. I don't know whether we want to increase the resources
silently for Emacs.

> -- Anders Lindgren

Best regards, Michael.