cleaning up backend process after death of CGI process

Поиск
Список
Период
Сортировка
От Moore, Duane
Тема cleaning up backend process after death of CGI process
Дата
Msg-id EFEE6F7115D3CF11B70A00805FA66198010705D5@cosexchange.cos.gsc.gte.com
обсуждение исходный текст
Список pgsql-general
I am having a small problem using postgres with a libpq++ based CGI program.
The program works fine almost all of the time.  However, from time to time,
the machine running postgres will have several backend processes running
that are simply burning CPU cycles.  I think that I have tracked down the
root of the problem to be a stray backend process that was not cleaned up
whenever someone hit the "Stop" or "Cancel" button on their browser while
performing a large database search.  Once this happens, the stray process
prevents other processes from accessing the data they need in a timely
fashion (or at all).

So my question is twofold:  Is there a way to detect when my CGI program is
killed by the web server (I'm using Netscape Enterprise 3.5) by catching a
signal or something?  This way I could close any postgres connections,
though I'm not sure that simply deleting the PgDatabase object would prevent
whatever is happening right now.

Secondly, is there (or shouldn't there be) a way that Postgres can detect
when it has lost the connection to the front end process (the client) and
automatically clean up so that the "cancelled" processes are not still lying
around?

Please cc any responses to me since I am not subscribed to the list yet.

Thanks,
Duane Moore
duane.moore@gsc.gte.com

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [ADMIN] Re: [SQL] Data recovery
Следующее
От: srcho@newcc.co.kr (songraeCHO)
Дата:
Сообщение: How to use korean in Postgres6.4.2