Re: Is there any problem with pg_notify and memory consumption?

Поиск
Список
Период
Сортировка
Искать
От
Simon Riggs
Тема
Re: Is there any problem with pg_notify and memory consumption?
Дата
в 12:42:24
Msg-id
BANLkTinzPfGGT+SPmpsroNRN73B3ZZskeg@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Is there any problem with pg_notify and memory consumption? Per-Olov Esgard <Per-Olov.Esgard@micronic-mydata.com>
Re: Is there any problem with pg_notify and memory consumption? Tom Lane <tgl@sss.pgh.pa.us>
Re: Is there any problem with pg_notify and memory consumption? Per-Olov Esgard <Per-Olov.Esgard@micronic-mydata.com>
Re: Is there any problem with pg_notify and memory consumption? Tom Lane <tgl@sss.pgh.pa.us>
Re: Is there any problem with pg_notify and memory consumption? Merlin Moncure <mmoncure@gmail.com>
Re: Is there any problem with pg_notify and memory consumption? Merlin Moncure <mmoncure@gmail.com>
On Fri, May 27, 2011 at 4:28 PM, Tom Lane  wrote:

> Hah, I replicated the problem.  Here is what's going on: the main loop
> in PostgresMain is intended to do its work in MessageContext.  But if
> ProcessCompletedNotifies does any work, it exits with
> CurrentMemoryContext having been reset to TopMemoryContext during
> transaction commit.  This means any memory that the main loop doesn't
> bother to explicitly free during the next command cycle will get leaked.
> The reason we haven't noticed this seems to be that the only case where
> any such memory does get leaked is if we have to do encoding conversion
> on the incoming command.  Also, the bug has only been there since 9.0.
>
> I think the right fix is to make sure that ProcessCompletedNotifies
> saves and restores the call-time CurrentMemoryContext.

Can we put a WARNING in there if we try to commit while in TopMemoryContext?

That way we'll trap any future leaks in core/add-on code.

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-general по дате отправления
От: Merlin Moncure
Дата:
Сообщение: Re: copy record?
От: Tom Lane
Дата:
FAQ