Re: An I/O error occured while sending to the backend

Lists: pgsql-jdbc
From: "Anthony Chaffey" <anthony(at)webmediaworks(dot)co(dot)uk>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: An I/O error occured while sending to the backend
Date: 2005-04-06 10:10:07
Message-ID: 001701c53a90$cf879cc0$6600a8c0@kermit
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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(AbstractJdbc2Stateme
nt.java:388)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdb
c2Statement.java:313)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2St
atement.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(QueryExecutorImp
l.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


From: John R Pierce <pierce(at)hogranch(dot)com>
To: anthony(at)webmediaworks(dot)co(dot)uk
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: An I/O error occured while sending to the backend
Date: 2005-04-06 16:24:45
Message-ID: 42540D4D.2000504@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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....


From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: anthony(at)webmediaworks(dot)co(dot)uk, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: An I/O error occured while sending to the backend
Date: 2005-04-06 17:35:52
Message-ID: 1112808952.20921.42.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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)


From: Markus Schaber <schabi(at)logix-tt(dot)com>
To: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
Cc: John R Pierce <pierce(at)hogranch(dot)com>, anthony(at)webmediaworks(dot)co(dot)uk, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: An I/O error occured while sending to the backend
Date: 2005-04-07 10:49:14
Message-ID: 4255102A.9030800@logix-tt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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


From: "Anthony Chaffey" <anthony(at)webmediaworks(dot)co(dot)uk>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: An I/O error occured while sending to the backend
Date: 2005-04-07 11:34:44
Message-ID: 001701c53b65$cc5008a0$6600a8c0@kermit
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

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