Re: Memory leak with CALL to Procedure with COMMIT.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory leak with CALL to Procedure with COMMIT.
Date: 2018-08-16 16:46:26
Message-ID: 20180816164626.myww6omfjm3jvwyq@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-Aug-16, Peter Eisentraut wrote:

> There are, technically, three ways to fix this: silence the warning,
> unregister the snapshot explicitly, or don't register the snapshot to
> begin with.
>
> Silencing the warning, other than by just deleting it, might require
> passing in some more context information into ResourceOwnerRelease().
> (The existing isTopLevel isn't quite the right thing.)
>
> Unregistering the snapshot explicitly looks tricky because in
> SPI_commit() or thereabouts we have no context information about which
> snapshot might have been registered where.

Hmm, this got me thinking whether the current resource owner setup for a
procedure is appropriate. Maybe the problem is that resowners are still
thought of in terms of transactions plus portals, so that if
transactions are done then everything is over; maybe we need to teach
them that procedures can outlive transactions, so you'd have a resowner
that's global to the procedure and then each transaction resowner is a
child of that one?

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-08-16 16:49:29 Re: Stored procedures and out parameters
Previous Message Alvaro Herrera 2018-08-16 16:37:57 Re: FailedAssertion on partprune