Re: Is this a time-out issue?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sanju Nath" <snath(at)riainternational(dot)com>
Cc: TimothyReaves(at)westfieldgrp(dot)com, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Is this a time-out issue?
Date: 2003-01-30 23:21:04
Message-ID: 450.1043968864@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> What happens is that the client still sends data, but it does not get
> written to the db. If I restart the Java app, all is well again. This
> seems to happen after extended periods of being idle. Currently the app is
> in testing, so goes for days without receiving data. I have been unable to
> determine where the breakage is. I think the issue is that the connection
> to the db times out, or the socket to the client times out.

I bet there's a firewall or NAT translator between the client and server
machines?

There are no timeouts in the database, nor AFAIK in the JDBC driver.
But it's entirely possible, if you send no data for a long time, that
something in between might decide the connection is dead.

In particular, NAT translation requires the machine doing it to keep
track of some state about each connection that's passing through it.
I'd expect the translator to drop its state info about a connection
that's seen no traffic for a long while.

The PG server does configure TCP_KEEPALIVE behavior on its socket,
and in an ideal world the server machine's kernel would issue keepalive
packets often enough to keep any intervening firewalls from dropping
the connection. But I suspect that it's not happening that way for you.

If you're really lucky, you can adjust the keepalive delay in the
server's kernel, or the connection-drop timeout in the intervening
firewall, so that the existing mechanism will solve your problem.
If you're not lucky, you may have to put some dummy queries into the
client app.

regards, tom lane

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2003-01-31 00:45:47 Re: JDBC 3.0 Compliance
Previous Message Sanju Nath 2003-01-30 22:26:20 Re: Is this a time-out issue?