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 1rYEdG-00EzCG-KI for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Feb 2024 00:20:43 +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 1rYEdF-004bxF-Ol for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Feb 2024 00:20:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYEdF-004bx7-G2 for pgsql-bugs@lists.postgresql.org; Fri, 09 Feb 2024 00:20:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYEdD-006DI9-5z for pgsql-bugs@lists.postgresql.org; Fri, 09 Feb 2024 00:20:40 +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 4190KZYM1278318; Thu, 8 Feb 2024 19:20:35 -0500 From: Tom Lane To: Andres Freund cc: Thomas Munro , Etsuro Fujita , 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: <20240209000734.st2xwkfsrz7izbnx@awork3.anarazel.de> References: <17828-122da8cba23236be@postgresql.org> <423731.1678381075@sss.pgh.pa.us> <1adf8fee-5a9a-69c2-057a-87bbddebab9d@gmail.com> <974582.1707411864@sss.pgh.pa.us> <20240208215920.myib264liwbkdndp@awork3.anarazel.de> <1273950.1707436232@sss.pgh.pa.us> <20240209000734.st2xwkfsrz7izbnx@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 08 Feb 2024 16:07:34 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1278316.1707438035.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 08 Feb 2024 19:20:35 -0500 Message-ID: <1278317.1707438035@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > I might be missing something here, but leaving the concrete crash aside,= why > is it ok for pgfdw_get_cleanup_result() etc to block during abort proces= sing? It's not pretty, for sure. I thought briefly about postponing the cleanup until we next try to use the connection, but I fear the semantic side-effects of that would be catastrophic. We can't leave the remote's query sitting open long after the local transaction has been canceled --- that risks undetected deadlocks, at the least. I think all we can do is try to reduce the risk of failure during transaction cleanup. regards, tom lane