Re: [BUGS] BUG #14843: CREATE TABLE churns through all memory,crashes db

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [BUGS] BUG #14843: CREATE TABLE churns through all memory,crashes db
Дата
Msg-id 20171006180143.rq3idmtijbeahjyj@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14843: CREATE TABLE churns through all memory,crashes db  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: [BUGS] BUG #14843: CREATE TABLE churns through all memory, crashes db
Список pgsql-bugs
On 2017-10-06 12:57:59 +0900, Michael Paquier wrote:
> On Fri, Oct 6, 2017 at 10:00 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
> > This is suspicious:
> >       ExecutorState: 62906368 total in 17 blocks; 13736 free (35
> > chunks); 62892632 used
> 
> The introduction of the ProjectSet node has caused the regressionin
> the executor visibly. A bisect run is showing me this commit as the
> culprit
> commit 69f4b9c85f168ae006929eec44fc44d569e846b9
> Author: Andres Freund <andres@anarazel.de>
> Date:   Wed Jan 18 12:46:50 2017 -0800
> Move targetlist SRF handling from expression evaluation to new executor node.
> 
> I was expecting a leak of some kind first, but valgrind does not
> complain when executing the query eating all the memory. Before this
> commit the memory usage remains low and stable, less than 1% in my
> environments.

It's "just" a MemoryContextSwitchTo() that some idiot^WI forgot and
reviews didn't spot. The ResetExprContext() in ExecProjectSet() is
correctly placed afaict, it's just that we leak (query scope) a lot into
the surrounding memory context.  A MemoryContextSwitchTo() at the top &
bottom of ExecProjectSet() fixes the issue for me.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14845: postgres_fdw and mysql_fdw can cause crash of instance
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14843: CREATE TABLE churns through all memory, crashes db