Re: max_files_per_processes vs others uses of file descriptors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: max_files_per_processes vs others uses of file descriptors
Date: 2017-08-07 20:52:42
Message-ID: 22079.1502139162@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> These days there's a number of other consumers of
> fds. E.g. postgres_fdw, epoll, ... All these aren't accounted for by
> fd.c.

> Given how close max_files_per_process is to the default linux limit of
> 1024 fds, I wonder if we shouldn't increase NUM_RESERVED_FDS by quite a
> bit?

No, I don't think so. If you're depending on the NUM_RESERVED_FDS
headroom for anything meaningful, *you're doing it wrong*. You should be
getting an FD via fd.c, so that there is an opportunity to free up an FD
(by closing a VFD) if you're up against system limits. Relying on
NUM_RESERVED_FDS headroom can only protect against EMFILE not ENFILE.

What this means is that the epoll stuff needs to be tied into fd.c more
than it is now, but that's likely a good thing anyway; it would for
example provide a more robust way of ensuring we don't leak epoll FDs at
transaction abort.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-08-07 20:59:44 Re: max_files_per_processes vs others uses of file descriptors
Previous Message Andres Freund 2017-08-07 20:40:33 max_files_per_processes vs others uses of file descriptors