Thread: An I/O error occured while sending to the backend
Hi,
I have developed an application using the postgresql-8.0-310.jdbc3 driver and connecting to a postgresql 8.0.1 database running on fedora core 3. Everything was working fine until i started running the application on the clients pc's. Randomly they receive an error, the stack trace of which is below.
The only difference between my testing pc and the client's pc's is that they use a wireless network card. Both my machine and the client's pc's are running Windows XP with SP2. Similar problems have been posted on this mailing list and people have suggested a firewall is clearing the connection which makes sense as the client claims this problem only occurs if the application is left idle for a short time but does anyone have any more information that may help?
Thanks for any help.
Anthony.
Stack Trace:
org.postgresql.util.PSQLException: An I/O error occured while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:201)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:313)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:220)
......
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.EOFException
at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:243)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1122)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
... 35 more
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 05/04/2005
Anthony Chaffey wrote: > Hi, > > > I have developed an application using the postgresql-8.0-310.jdbc3 > driver and connecting to a postgresql 8.0.1 database running on fedora > core 3. Everything was working fine until i started running the > application on the clients pc's. Randomly they receive an error, the > stack trace of which is below. > > The only difference between my testing pc and the client's pc's is that > they use a wireless network card. Both my machine and the client's pc's > are running Windows XP with SP2. Similar problems have been posted on > this mailing list and people have suggested a firewall is clearing the > connection which makes sense as the client claims this problem only > occurs if the application is left idle for a short time but does anyone > have any more information that may help? its probaly exactly what you say, most firewalls, NAT routers, etc will time out idle sockets after a certain number of minutes... They have to do this, otherwise the firewall's connection tracking tables will fill up with old flug. only good solution is to catch the exception, and attempt to reopen the database connection, and retry the operation....
On Wed, 2005-04-06 at 11:24, John R Pierce wrote: > Anthony Chaffey wrote: > > Hi, > > > > > > I have developed an application using the postgresql-8.0-310.jdbc3 > > driver and connecting to a postgresql 8.0.1 database running on fedora > > core 3. Everything was working fine until i started running the > > application on the clients pc's. Randomly they receive an error, the > > stack trace of which is below. > > > > The only difference between my testing pc and the client's pc's is that > > they use a wireless network card. Both my machine and the client's pc's > > are running Windows XP with SP2. Similar problems have been posted on > > this mailing list and people have suggested a firewall is clearing the > > connection which makes sense as the client claims this problem only > > occurs if the application is left idle for a short time but does anyone > > have any more information that may help? > > its probaly exactly what you say, most firewalls, NAT routers, etc will time > out idle sockets after a certain number of minutes... They have to do this, > otherwise the firewall's connection tracking tables will fill up with old flug. > > only good solution is to catch the exception, and attempt to reopen the > database connection, and retry the operation.... Does setting a lower tcp_keepalive_time help these problems with NAT? It certainly fixed the problems I've seen with non-NAT firewalls. (this is a linux kernel setting, i'm sure there's an equivalent for other unixes)
Hi, Scott, Scott Marlowe schrieb: >>only good solution is to catch the exception, and attempt to reopen the >>database connection, and retry the operation.... > Does setting a lower tcp_keepalive_time help these problems with NAT? > It certainly fixed the problems I've seen with non-NAT firewalls. (this > is a linux kernel setting, i'm sure there's an equivalent for other > unixes) java.net.Socket has some settings about timeouts and keepalives, maybe those will help. Markus
Attachment
Thanks to everyone for their responses.
I have now coded the application to catch the exception an determine whether it is an i/o problem and attempts to re-connect to the database. I will look into the socket time-out settings but I have realised that my solution also holds up well when a network/internet connection is lost entirely.
Thanks again.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 06/04/2005