Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY7p7-00EVBz-H9 for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Feb 2024 17:04:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rY7p6-001fS2-Ke for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Feb 2024 17:04:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY7p6-001fRt-CE for pgsql-bugs@lists.postgresql.org; Thu, 08 Feb 2024 17:04:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY7p3-005kKl-Kg for pgsql-bugs@lists.postgresql.org; Thu, 08 Feb 2024 17:04:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 418H4O7J974583; Thu, 8 Feb 2024 12:04:24 -0500 From: Tom Lane To: Etsuro Fujita cc: Alexander Lakhin , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17828: postgres_fdw leaks file descriptors on error and aborts aborted transaction in lack of fds In-reply-to: References: <17828-122da8cba23236be@postgresql.org> <423731.1678381075@sss.pgh.pa.us> <1adf8fee-5a9a-69c2-057a-87bbddebab9d@gmail.com> Comments: In-reply-to Etsuro Fujita message dated "Thu, 08 Feb 2024 21:06:38 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <974581.1707411864.1@sss.pgh.pa.us> Date: Thu, 08 Feb 2024 12:04:24 -0500 Message-ID: <974582.1707411864@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Etsuro Fujita writes: > IIUC I think the assertion failure was caused by an > error-during-error-recovery loop caused by the "epoll_create1 failed: > Too many open files" error raised in WaitLatchOrSocket called from > pgfdw_get_cleanup_result, which is called during abort cleanup. I > think a simple fix to avoid such a loop is to modify the PG_CATCH > block in pgfdw_get_cleanup_result so that it just ignores the passed > error, not re-throwing it, and restores InterruptHoldoffCount and the > memory context, like the attached. In the patch I also modified > callers of pgfdw_get_cleanup_result to issue a warning when ignoring > the error. I might be missing something, though. I do not think ignoring the passed error is *ever* acceptable. You have no idea what the error condition is or whether your hack is sufficient to recover from it. regards, tom lane