[Dev] PostgreSQL connection timeout
Jon Carnes
jonc at nc.rr.com
Tue Jan 13 22:21:04 EST 2004
Did you see this entry?
http://forums.devshed.com/t45649/s.html
This guy had no problems if both machines were on the same subnet since
the connection was directly machine to machine (no firewall or router
in-between).
You might want to modify your app to put a small heart-beat across the
connection every 10 seconds. Read an update block in the Database every
10 seconds. That will act as a keep-alive.
Good Luck - Jon Carnes
On Tue, 2004-01-13 at 18:10, Richard O. Hammer wrote:
> I have PostgreSQL 7.3.2 running on Red Hat 7.3, and I am connecting to
> it from a Java Virtual Machine on Windows 2000. Usually it runs fine.
> But sometimes it breaks, seemingly with a connection timeout. I
> hope for suggestions on what to do about this.
>
> When my problem happens, I get a stack trace like this on the client
> (Windows) side:
>
> An I/O error occurred while reading from backend - Exception:
> java.net.SocketException: Connection reset by peer: JVM_recv in socket
> input stream read
> Stack Trace:
>
> java.net.SocketException: Connection reset by peer: JVM_recv in socket
> input stream read
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.read(SocketInputStream.java:116)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
> at org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:138)
> at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:71)
> ...
>
>
> And on the Linux server side I see the following message in
> /var/log/messages. I believe this message relates to the problem I am
> having.
>
> Jan 10 22:54:59 r postgres[27572]: [1] LOG: pq_recvbuf: recv()
> failed: Connection timed out
>
> Searching, I found my error message mentioned on one PostgreSQL email
> list. The reply given there told that this is not a PostgreSQL
> problem, but an underlying kernel or TCP thing on Linux.
>
> So, I don't know what to ask exactly, but is there a default TCP
> connection timeout on Linux? that I could maybe set?
>
> Thanks,
> Rich Hammer
>
> _______________________________________________
> Dev mailing list
> Dev at trilug.org
> http://www.trilug.org/mailman/listinfo/dev
More information about the Dev
mailing list