Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRnyo-0007TG-Rg for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2016 22:04:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bRnyo-00064K-6Q for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2016 22:04:06 +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 1bRnyn-000644-Ex for pgsql-hackers@postgresql.org; Mon, 25 Jul 2016 22:04:05 +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 1bRnyk-0005QK-RS for pgsql-hackers@postgresql.org; Mon, 25 Jul 2016 22:04:04 +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 u6PM40lJ000620; Mon, 25 Jul 2016 18:04:00 -0400 From: Tom Lane To: Alvaro Herrera cc: Amit Kapila , pgsql-hackers Subject: Re: Curing plpgsql's memory leaks for statement-lifespan values In-reply-to: <20160725211919.GA298355@alvherre.pgsql> References: <20160725211919.GA298355@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Mon, 25 Jul 2016 17:19:19 -0400" Date: Mon, 25 Jul 2016 18:04:00 -0400 Message-ID: <619.1469484240@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> Although this is in principle a bug fix, it's invasive enough that I'd >> be pretty hesitant to back-patch it, or even to stick it into HEAD >> post-beta. I'm inclined to sign it up for the next commitfest instead. > Do we have a backpatchable fix for the reported problem? If so, then it > seems a good tradeoff to install this more invasive fix in HEAD only and > apply the simpler fix to back branches. Otherwise, is the proposal to > leave the bug unfixed in back branches? The latter is what I was thinking. Given that issues like this have been there, and gone unreported, since we invented subtransactions, I do not feel too awful about not fixing it in existing branches. It's possible that we could fix just the one issue originally complained of with a smaller patch, but I don't find that approach attractive, because it was also a small leak. The case that seemed nastiest to me is that a FOREACH ... IN ARRAY loop will leak a copy of the entire array if an error causes control to be thrown out of exec_stmt_foreach_a. That could be a lot more leaked data than the querystring of an EXECUTE. I suppose that a fix based on putting PG_TRY blocks into all the affected functions might be simple enough that we'd risk back-patching it, but I don't really want to go that way. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers