Re: Hung backends - Mailing list pgsql-general

From Joseph Shraibman
Subject Re: Hung backends
Date
Msg-id 3A22F3DE.31F45B28@selectacast.net
Whole thread Raw
In response to Re: Hung backends  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
>
> "Schmidt, Peter" <peter.schmidt@prismedia.com> writes:
> > It turned out the Java VM was still running on the clients, keeping TCP
> > connections open (exactly as you suggested).
>
> Hmm, so the VM forgets to close connections belonging to a crashed
> Java thread?  Seems like a severe deficiency in the VM to me...
>
>                         regards, tom lane

There is no such thing as a crashed java thread.  It either terminated
or is still running.  You are supposed to explictly close your
connections to the db in java.  If you don't you will have to wait until
the Connection object is garbage collected for it to be closed.  If your
java app is sitting around not doing much then it might never get around
to calling the garbage collector.

Bottom line:
1) expliclty close connections yourself
2) Call System.gc() from time to time if you need to.

--
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com

pgsql-general by date:

Previous
From: John Pilley
Date:
Subject: Cannot createdb a database I just "destroydb"'d
Next
From: shawn everett
Date:
Subject: Is this possible or am I on drugs :)