RE: PostgreSQL and Unicode

Tatsuo Ishii <t-ishii@sra.co.jp>

From: Tatsuo Ishii <t-ishii@sra.co.jp>
To: rmager@vgkk.co.jp
Cc: ishii@postgresql.org, hackers@postgresql.org
Date: 2000-05-16T09:30:48Z
Lists: pgsql-hackers
> Regarding the "postmaster processes not going away" problem...
> 
> We're developing a Java application that connects to a PostgreSQL db. During
> our development process we debug the code and sometimes kill the program in
> the middle of the run. Sometimes this means that an open Connection to the
> database is not properly closed. Now, I realize that this is an unfriendly
> thing to do to PG but I would think it would eventually recover. What
> happens instead is that the postmaster/postgres process that was handling
> that connection never terminates. I have seen processes that are more than 2
> weeks old before we noticed and restarted postmaster manually.
> 
> The problem is that eventually PG runs out of connections and stops allowing
> new ones.
> 
> So, is there a way to tell PG to timeout unused connections after some
> specified time? I've looked through all the docs and could not find anything
> like this. I realize that this is a difficult issue because if there is an
> unresolved transaction what do you do with it. I guess all you could do is
> roll it back.
> 
> Any other suggestions? If not, can I request this as a future feature?
> Although our problems are happening during debugging, they could happen
> during deployment given a hardware problem or, *gasp*, a bug in our code.

What about adding KEEPALIVE option to the socket? This would take a
while to detect orphaned socket, though.
--
Tatsuo Ishii