Quoting Didier Bretin <dbr@informactis.com>:
> Hello,
>
> I use postgres with my servlet on a linux box. Sometimes when I do
> a 'ps auxf' I saw that I have a lot (about 20) of postgres process like
> this:
> postgres 19025 0.0 0.7 31124 988 ? SN 2000 4:59
> /cassiope/usr/local/postgresql-7.0/bin/postmaster -D
> /cassiope/var/pgdata2 -p 5430 -i
> postgres 25749 0.0 2.1 31472 2724 ? SN 09:18 0:00 \_
> /cassiope/usr/local/postgresql-7.0/bin/postgres 127.0.0.1 admintp
> truckplus_1 idle
> postgres 26528 0.0 2.3 31680 2976 ? SN 10:00 0:00 \_
> /cassiope/usr/local/postgresql-7.0/bin/postgres 127.0.0.1 admintp
> truckplus_1 idle
> postgres 26663 0.0 2.1 31492 2788 ? SN 10:09 0:00 \_
> /cassiope/usr/local/postgresql-7.0/bin/postgres 127.0.0.1 admintp
> truckplus_1 idle
>
> And sometimes when the number of process is so big, I can't connect to
> postgresql with jdbc :o(.
> Apparently, the connections opened are not close by the garbage
> collector ...
>
> Is there a solution to avoid such problem ?
Is your application calling the close() method in Connection? The garbage
collector will never close a connection.
Also, you can not guarantee when garbage collection will occur (sometimes it
never will). It all depends on how the JVM & Garbage Collector is implemented.
Peter
--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/