Re: connection reset error, followed by broken pipe (pg74.213.jdbc3.jar) - Mailing list pgsql-jdbc

From Markus Schaber
Subject Re: connection reset error, followed by broken pipe (pg74.213.jdbc3.jar)
Date
Msg-id 4444C6CE.40402@logix-tt.com
Whole thread Raw
In response to connection reset error, followed by broken pipe (pg74.213.jdbc3.jar)  ("Ed Blackmore" <me@edblackmore.net>)
List pgsql-jdbc
Hi, Ed,

Ed Blackmore wrote:

> I'm having trouble with a tomcat-postgres installation. Server 1 runs
> postgresql and tomcat, server 2 has an identical tomcat installation
> and application code running (except rebranding). Server 2 has errors
> about every week with 'connection reset' in logs/appname.date.log,
> futher connection attempts have a 'broken pipe' error.

So it seems that the network connection breaks from time to time.
Independently from making your application more robust, you might want
to put some research into that.

> The solution to get the app running again is to restart tomcat.

There was a thread here some days ago with the title "No automatic
reconnect after network error", you might have a look there.


If you're using the tomcat connection pooling, my proposed solution
there might help you:

| At least JBoss, you can use the following approach: In the Datasource
| definition, put the following:
|
| <datasources>
|   <no-tx-datasource>
|     <jndi-name>boo</jndi-name>
|    <connection-url>jdbc:postgresql://localhost:5432/bar</connection-url>
|     [ ... other attributes ... ]
|     <new-connection-sql>SELECT version()</new-connection-sql>
|     <check-valid-connection-sql>SELECT
| version()</check-valid-connection-sql>
|   </no-tx-datasource>
| </datasources>
|
| This validates the connection before it is handed out on the
| application, and throws away invalid connections. Be aware that the SQL
| is case sensitive, we had a problem with earlier versions of OpenMDX/CRX
| that had upper case letters in the tags so they were ignored by jboss.

HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

pgsql-jdbc by date:

Previous
From: "Ed Blackmore"
Date:
Subject: connection reset error, followed by broken pipe (pg74.213.jdbc3.jar)
Next
From: "Xavier Poinsard"
Date:
Subject: Patch adding empty missing columns for getTables