Re: Memory leak with CALL to Procedure with COMMIT. - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Memory leak with CALL to Procedure with COMMIT.
Date
Msg-id 20180816164626.myww6omfjm3jvwyq@alvherre.pgsql
Whole thread Raw
In response to Re: Memory leak with CALL to Procedure with COMMIT.  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Memory leak with CALL to Procedure with COMMIT.
List 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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: FailedAssertion on partprune
Next
From: Peter Eisentraut
Date:
Subject: Re: Stored procedures and out parameters