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)