Connection pooling problems - Mailing list pgsql-jdbc

From Didrik Pinte
Subject Connection pooling problems
Date
Msg-id 5.1.0.14.0.20030204092303.0245ee60@192.168.0.11
Whole thread Raw
Responses Re: Connection pooling problems
List pgsql-jdbc
Hi,

I'm currently running a Tomcat 4.0.6 using a pooled data source as a JNDI
ressource (using the jakarta commons DBCP). The database is a PostgreSQL
7.3. The two computers are separated by a firewall. Everything works fine
except a strange problem I can't solve.

After a day on (it is not very regular), the application can't connect
anymore to the database, i'm getting the following error in the Tomcat's log:

An I/O error has occured while flushing the output - Exception:
java.net.SocketException: Connection reset by peer: socket write error
Stack Trace:

java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite(Native Method)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:96)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:72)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:130)
    at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
    ...

In the postgres log, i'm reading :

Feb  3 21:10:47 XXXXXXX postgres[9934]: [4] LOG:  pq_recvbuf: recv()
failed: Connection reset by peer

My JNDI ressource is configured like that :

  <Resource name="jdbc/refPG" auth="Container" type="javax.sql.DataSource" />
                <ResourceParams name="jdbc/refPG">
                   <parameter>
                      <name>username</name>
                      <value>myusername</value>
                   </parameter>
                   <parameter>
                      <name>password</name>
                      <value>*******</value>
                   </parameter>
                   <parameter>
                      <name>driverClassName</name>
                      <value>org.postgresql.Driver</value>
                   </parameter>
                   <parameter>
                      <name>url</name>
                      <value>jdbc:postgresql://hostname/db</value>
                   </parameter>
                   <parameter>
                      <name>factory</name>
                      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                   </parameter>
                   <parameter>
                      <name>maxActive</name>
                      <value>50</value>
                   </parameter>
                   <parameter>
                      <name>maxIdle</name>
                      <value>10</value>
                   </parameter>
                   <parameter>
                      <name>maxWait</name>
                      <value>10000</value>
                   </parameter>
                   <parameter>
                      <name>removeAbandoned</name>
                      <value>true</value>
                   </parameter>
                   <parameter>
                      <name>removeAbandonedTimeout</name>
                      <value>60</value>
                   </parameter>
                   <parameter>
                      <name>logAbandoned</name>
                      <value>true</value>
                   </parameter>
                </ResourceParams>


Do someone knows why I receive such an error ? I have no information in my
firewall log about denying access, but I suspect the configuration of the
pool being the origin of it. Maybe do I have to use
org.postgresql.jdbc2.optional.PooledDataSource in place of
org.postgresql.Driver in my configuration ?

Any help is welcome.

Thanks

Didrik Pinte
Adhoc Solutions
www.adhocsolutions.com



**** DISCLAIMER ****
This e-mail and any attachments thereto may contain information
which is confidential and/or protected by intellectual property
rights and are intended for the sole use of the recipient(s) named above.
Any use of the information contained herein (including, but not limited to,
total or partial reproduction, communication or distribution in any form)
by persons other than the designated recipient(s) is prohibited.
If you have received this e-mail in error, please notify the sender
and delete the material from any computer.
Thank you for your cooperation.



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Unusable resultset [Viruschecked]
Next
From: Tom Lane
Date:
Subject: Re: Connection pooling problems