| From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
|---|---|
| To: | Srinath Reddy Sadipiralla <srinath(dot)reddy(at)zohocorp(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Question: Why Are File Descriptors Not Closed and Accounted for PostgreSQL Backends? |
| Date: | 2024-05-24 13:45:54 |
| Message-ID: | e340b428-764c-4b44-baea-653769fa454d@iki.fi |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 24/05/2024 15:17, Srinath Reddy Sadipiralla wrote:
> 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
Yes we do, see FreeWaitEventSet().
The WaitEventSet created fro pq_init() is never explicitly free'd
though, because it's created in the per-connection backend process. When
the connection is terminated, the backend process exits, cleaning up any
resources including the WaitEventSet.
--
Heikki Linnakangas
Neon (https://neon.tech)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2024-05-24 13:54:14 | Re: First draft of PG 17 release notes |
| Previous Message | Robert Haas | 2024-05-24 13:28:32 | Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs |