Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cgFre-00062g-Vn for pgsql-committers@arkaria.postgresql.org; Tue, 21 Feb 2017 19:12:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cgFre-0004by-Ie for pgsql-committers@arkaria.postgresql.org; Tue, 21 Feb 2017 19:12:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cgFrR-0004M7-39 for pgsql-committers@postgresql.org; Tue, 21 Feb 2017 19:12:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cgFrO-0000k9-RX; Tue, 21 Feb 2017 19:12:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v1LJCQMP002059; Tue, 21 Feb 2017 14:12:26 -0500 From: Tom Lane To: Fujii Masao cc: pgsql-committers@postgresql.org Subject: Re: pgsql: Fix connection leak in DROP SUBSCRIPTION command. In-reply-to: References: Comments: In-reply-to Fujii Masao message dated "Tue, 21 Feb 2017 18:36:35 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2057.1487704345.1@sss.pgh.pa.us> Date: Tue, 21 Feb 2017 14:12:25 -0500 Message-ID: <2058.1487704345@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org Fujii Masao writes: > Fix connection leak in DROP SUBSCRIPTION command. > Previously the command forgot to close the connection to the publisher > when it failed to drop the replication slot. If there's a bug here, this seems like an extremely unreliable way of fixing it. What if an error gets thrown before you reach that ereport? In other words, this coding is assuming that the walrcv_command() subroutine cannot throw an error, which I would consider dangerous even if it were a fixed subroutine. If it's a hook that's doing unknown stuff, that seems a completely untenable assumption. You really need either to hook the cleanup action into normal error recovery, or to use a PG_TRY block. regards, tom lane -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers