pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stéphane RIFF <stephane.riff@cerene.fr>
To: pg@fastcrypt.com
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [SPAM] - Re: Connection pool problem - Found word(s) list
Date: Tue, 01 Mar 2005 14:37:33 +0100
Message-ID: <4224701D.9080002@cerene.fr> (raw)
In-Reply-To: <42246D04.1060506@fastcrypt.com>
References: <42242041.8030604@cerene.fr>
	<422456E7.8060303@opencloud.com>
	<42246A2E.60604@cerene.fr>
	<42246D04.1060506@fastcrypt.com>

Yes sorry that's what i want to say "finally" blocks
and that's what i did.

For the exception i don"t have any more idea yet
Dave Cramer wrote:

> Stephane,
>
> You didn't read his email carefully enough. Close your connections in 
> a FINALLY block. That way they are guaranteed to be closed
>
> as far as your exception below, that is very strange. If you are out 
> of connections on the server then you should get that error
> not a bind exception ???
>
> Dave
>
>
> Stéphane RIFF wrote:
>
>> You're right i forgot to call close() function in the catch block
>> Thanks
>>
>> But know i sometimes get null connections from the datasource with 
>> exception like this :
>> 2005-03-01 12:23:44,156 : [WARN] ConnectionPool - 
>> org.postgresql.util.PSQLException: The connection attempt failed 
>> because Exception: java.net.BindException: Address already in use: 
>> connect
>> Stack Trace:
>>
>> java.net.BindException: Address already in use: connect
>>    at java.net.PlainSocketImpl.socketConnect(Native Method)
>>    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
>>    at 
>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
>>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
>>    at java.net.Socket.connect(Socket.java:452)
>>    at java.net.Socket.connect(Socket.java:402)
>>    at java.net.Socket.<init>(Socket.java:309)
>>    at java.net.Socket.<init>(Socket.java:124)
>>    at org.postgresql.core.PGStream.<init>(PGStream.java:47)
>>    at 
>> org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:197) 
>>
>>    at org.postgresql.Driver.connect(Driver.java:139)
>>    at java.sql.DriverManager.getConnection(DriverManager.java:512)
>>    at java.sql.DriverManager.getConnection(DriverManager.java:171)
>>    at 
>> org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:48) 
>>
>>    at 
>> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290) 
>>
>>    at 
>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:771) 
>>
>>    at 
>> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95) 
>>
>>    at 
>> fr.cerene.geosiara.gprs.receiver.ConnectionPool.getConnection(ConnectionPool.java:97) 
>>
>>    at 
>> fr.cerene.geosiara.gprs.receiver.SQLoader.saveTrame(SQLoader.java:122)
>>    at fr.cerene.geosiara.gprs.receiver.SQLoader$1.run(SQLoader.java:219)
>>    at java.lang.Thread.run(Thread.java:534)
>> End of Stack Trace
>>
>> 2005-03-01 12:23:44,156 : [WARN] SQLoader - 
>> java.lang.NullPointerException
>>
>> I saw on the web that this can happened when the max number of 
>> connection
>> is reach but in my case postgresql is configure with 100 connections, in
>> the process list i had  ~50 connections.
>>
>> Don't know what i can do...
>>
>> Oliver Jowett wrote:
>>
>>> Stéphane RIFF wrote:
>>>
>>>> I've create a connection pool with dbcp end another with 
>>>> Jdbc3PoolingDatasource,
>>>> it seems to work well but :
>>>> My pool is a eight connections pool, the problem is when i get some 
>>>> database exception (for example
>>>> "constraint violation", "duplicate key on unique index"...) the 
>>>> connection didn't released to the pool.
>>>> After eight exception my application wait for a connection from the 
>>>> pool which nerver give one because
>>>> of the PSQLException thrown.
>>>
>>>
>>>
>>>
>>> Perhaps your code does not release the connection to the pool 
>>> correctly when handling the exception?
>>>
>>> The usual way to deal with this is to put connection releasing in a 
>>> finally block, so it's sure to be run however you exit the try{} block.
>>>
>>> If it's not that, I'd need to see your code to debug this further.
>>>
>>> -O
>>>
>>>
>>
>>
>>
>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.2 - Release Date: 28/02/2005




Message-ID: <4224701D.9080002@cerene.fr>
Permalink:  ../4224701D.9080002@cerene.fr/
Also on:    postgresql.org/message-id/4224701D.9080002@cerene.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: stephane.riff@cerene.fr, pg@fastcrypt.com, oliver@opencloud.com
  Subject: Re: [SPAM] - Re: Connection pool problem - Found word(s) list
  In-Reply-To: <4224701D.9080002@cerene.fr>
  References: <42242041.8030604@cerene.fr> <422456E7.8060303@opencloud.com> <42246A2E.60604@cerene.fr> <42246D04.1060506@fastcrypt.com> <4224701D.9080002@cerene.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox