Re: psql leaks memory on query cancellation

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: psql leaks memory on query cancellation
Дата
Msg-id CAMsr+YFHuT4+kVvWh-5+GSsBwYsq70Yriws-uDma_5akxo07VA@mail.gmail.com
обсуждение исходный текст
Ответ на psql leaks memory on query cancellation  (Darafei "Komяpa" Praliaskouski <me@komzpa.net>)
Ответы Re: psql leaks memory on query cancellation  (Darafei "Komяpa" Praliaskouski <me@komzpa.net>)
Re: psql leaks memory on query cancellation  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 12 April 2018 at 18:26, Darafei "Komяpa" Praliaskouski <me@komzpa.net> wrote:
> Hi,
>
> psql (PostgreSQL) 10.3
>
> Here are the steps to reproduce a leak:
>
> 1. connect to 10.3 server, perform the query similar to:
>
> select 'message' || generate_series(1,1000000000);
>
> 2. monitoring psql memory usage in htop or similar tool, press ctrl+c at
> some point where you can clearly distinguish a psql with a big allocated
> buffer from psql without it.
>
> 3. see the query cancelled, but psql memory usage stays the same.
>
> This is especially painful when query you're debugging has a runaway join
> condition, and you understand it only after it doesn't return in seconds as
> you've expected.
>
> Is it expected behavior (so I can have a look at something server returned
> somehow and it's kept there for me), or a plain leak?

This is totally normal behaviour for any C program.

It's part of why systems should have swap space. But it's generally
fairly harmless, as it's uncommon for apps to make huge allocations
only once then stay running with low memory use thereafter.

It would potentially be a leak if doing the same thing repeatedly led
to repeated growth.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: psql leaks memory on query cancellation
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Re: Covering GiST indexes