Re: Timeout Value on network error - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Timeout Value on network error
Date
Msg-id 20061105020439.GA10274@winnie.fuhr.org
Whole thread Raw
In response to Timeout Value on network error  (ecolgan@shiftwatch.com)
List pgsql-general
On Mon, Oct 30, 2006 at 11:46:01AM -0800, ecolgan@shiftwatch.com wrote:
> We're using a remote Postgres server to view video data.  It works
> well, but we're having a hard time making our app robust when the
> network fails.  For example, PQexec does not return consistently when
> the cable is disconnected.

Network connections use TCP, which was designed to be robust over
unreliable networks.  A TCP connection isn't supposed to fail right
away in the face of network problems like disconnected cables;
instead, TCP retransmits packets with the hope that connectivity
will soon be re-established.

> Is there a timeout value that we can configure, so all PQ* functions
> return consistently?

You could use asynchronous command processing with poll() or select().

http://www.postgresql.org/docs/8.1/interactive/libpq-async.html

--
Michael Fuhr

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: How to get joins to work
Next
From: Russell Smith
Date:
Subject: ERROR: tuple concurrently updated