Re: Preventing tuple-table leakage in plpgsql

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Preventing tuple-table leakage in plpgsql
Дата
Msg-id 20130723013835.GA150518@tornado.leadboat.com
обсуждение исходный текст
Ответ на Re: Preventing tuple-table leakage in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Preventing tuple-table leakage in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sun, Jul 21, 2013 at 12:40:38PM -0400, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > Reasonable enough.  Code that does use subtransactions will need to be more
> > careful than before to manually free tuple tables in the non-error case.
> > Failure to do so has been creating a leak that lasts until SPI_finish(), but
> > it will now be able to cause a transaction-lifespan leak.
> 
> Hmm ... good point.  The other plan I'd been considering was to add
> explicit tracking inside spi.c of all tuple tables created within the
> current procedure, and then have AtEOSubXact_SPI flush any that were
> created inside a failed subxact.  The tables would still be children of
> the procCxt and thus could not be leaked past SPI_finish.  When you
> suggested attaching to subtransaction contexts I thought that would let
> us get away without this additional bookkeeping logic, but maybe we
> should bite the bullet and add the extra logic.

Is there reason to believe we wouldn't eventually find a half dozen other
allocations calling for similar bespoke treatment?  Does something make tuple
tables special among memory allocations, or are they just the garden-variety
allocation that happens to bother the test case at hand?

> A change that's meant
> to remove leak risks really shouldn't be introducing other, new leak
> risks.

Yes; that gives one pause.

Thanks,
nm

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: [PATCH] Revive line type
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Preventing tuple-table leakage in plpgsql