Re: How does an application recognize the death of the postmaster - Mailing list pgsql-general

From Wayne Conrad
Subject Re: How does an application recognize the death of the postmaster
Date
Msg-id 20060503185701.GA26821@mail.yagni.com
Whole thread Raw
In response to How does an application recognize the death of the postmaster  (Geoffrey <esoteric@3times25.net>)
List 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 by date:

Previous
From: Sven Willenberger
Date:
Subject: Re: out of memory for query result
Next
From: "Larry Rosenman"
Date:
Subject: Re: out of memory for query result