Nasty resource-leak problem in sort code

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Nasty resource-leak problem in sort code
Дата
Msg-id 29883.925830451@sss.pgh.pa.us
обсуждение исходный текст
Ответы Re: Nasty resource-leak problem in sort code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
If a CREATE INDEX fails, the backend returns to the main loop without
having closed the temporary files that are created for sorting.
An easy example that provokes this is
create table titles (adate date);insert into titles values ('today');create index titles_f_ind on titles (date(adate)
date_ops);ERROR: SQL-language function not supported in this context.
 

after which the backend has about a dozen more open files than it had
before.

If you then try to create another index, you will crash for
lack of free file descriptors (unless your kernel has a
higher-than-usual open-files-per-process limit).  In any case, the
sort temp files will never get deleted from your database directory.

Offhand I'm not sure how to fix this.  The system knows about releasing
memory after an elog(ERROR), but does it have any provisions for
releasing other kinds of resources?  I suspect we need something
analogous to the on_shmem_exit() callback-registration list, but I
don't know whether it already exists.  Comments?
        regards, tom lane


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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: [HACKERS] posmaster failed under high load
Следующее
От: Dirk Lutzebaeck
Дата:
Сообщение: major flaw in 6.5beta1??? (UPDATE/INSERT waiting)