Question: Why Are File Descriptors Not Closed and Accounted for PostgreSQL Backends?

From: Srinath Reddy Sadipiralla <srinath(dot)reddy(at)zohocorp(dot)com>
To: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Question: Why Are File Descriptors Not Closed and Accounted for PostgreSQL Backends?
Date: 2024-05-24 12:17:00
Message-ID: 18faa8875f4.49d046c87367.7389892592798553133@zohocorp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi PostgreSQL Community,
when a backend process starts, pq_init is called where it opens a FD during CreateWaitEventSet()

if (!AcquireExternalFD())
{
/* treat this as though epoll_create1 itself returned EMFILE */
elog(ERROR, "epoll_create1 failed: %m");
}
set->epoll_fd = epoll_create1(EPOLL_CLOEXEC);

but we didn't closed or called ReleaseExternalFD() for accounting,lets say if we have multiple clients connected and are actively running queries, won't the max number of open FDs (ulimit -n) limit of the system gets reached and cause "Too many open files issue"?

Regards
Srinath Reddy

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yao Wang 2024-05-24 12:50:54 Re: 回复: An implementation of multi-key sort
Previous Message Ranier Vilela 2024-05-24 12:05:35 Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)