Re: How does an application recognize the death of the postmaster

Поиск
Список
Период
Сортировка
От Wayne Conrad
Тема Re: How does an application recognize the death of the postmaster
Дата
Msg-id 20060503185701.GA26821@mail.yagni.com
обсуждение исходный текст
Ответ на How does an application recognize the death of the postmaster  (Geoffrey <esoteric@3times25.net>)
Список pgsql-general
On Wed, May 03, 2006 at 02:44:03PM -0400, Geoffrey wrote:
> How do folks handle the death of the postmaster in their applications?
> Assuming the postmaster dies after an application has connected to the
> database, but before it makes a request.  What should I look for?
> Currently our application that's in development does not handle the
> situation well.  What we want to do is gracefully (as possible) shutdown
> the application.

90% of our code, and all of the critical engines, is written in ruby.
Some legacy code is in python.  Both of these languages handle
exceptions extremely well: When a database connection goes away, an
exception gets thrown the next time it tries to access the database.
If the application does nothing, the environment (language interpreter
and libraries) release memory, file handles, sockets, etc. without our
code having to doing anything, and then exits with an error code and a
stack trace.  All of this is done for us without writing any code to
do it -- it just comes with the environment.  We can (and often do)
catch the exception just to print a nicer message (stack traces are
programmer friendly but ugly), or to clean up the rare resource that
the libraries don't know about, but it's seldom more than a few lines
of code.  We don't have to think about it much.

Best Regards,
        Wayne Conrad

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

Предыдущее
От: Sven Willenberger
Дата:
Сообщение: Re: out of memory for query result
Следующее
От: "Larry Rosenman"
Дата:
Сообщение: Re: out of memory for query result