Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #439 > unrolled thread

Preventing a timeout on a connection

Started bygargoyle60 <gargoyle60@example.invalid>
First post2013-02-28 09:41 +0000
Last post2013-03-01 13:16 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.databases.postgresql


Contents

  Preventing a timeout on a connection gargoyle60 <gargoyle60@example.invalid> - 2013-02-28 09:41 +0000
    Re: Preventing a timeout on a connection "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-28 11:03 +0100
    Re: Preventing a timeout on a connection Jasen Betts <jasen@xnet.co.nz> - 2013-02-28 11:00 +0000
    Re: Preventing a timeout on a connection gargoyle60 <gargoyle60@example.invalid> - 2013-03-01 13:16 +0000

#439 — Preventing a timeout on a connection

Fromgargoyle60 <gargoyle60@example.invalid>
Date2013-02-28 09:41 +0000
SubjectPreventing a timeout on a connection
Message-ID<6f9ui8pi4ub903fl62kgg4t6793c5ph7b7@4ax.com>
In one of my background applications I keep getting a peer communication error stating that a
timeout occurred on a connection.

The program runs for most of the day processing background statistics. It has an open "connected"
connection but not always an active session on that connection, which is why I believe that the
timeout occurs because it is sitting idle. The timeout is not on a SQL statement or similar, but on
the idle connection.

Is there a specific parameter in one of the conf files or elsewhere that would help extend any
idle/timeout period (I've looked in the documentation but haven't been able to find anything
specific to connections alone).

I am using postgres 9.0.4 on Windows XP Home SP3.

Thanks

[toc] | [next] | [standalone]


#440

From"M. Strobel" <sorry_no_mail_here@nowhere.dee>
Date2013-02-28 11:03 +0100
Message-ID<ap8ob5Fmi92U1@mid.uni-berlin.de>
In reply to#439
Am 28.02.2013 10:41, schrieb gargoyle60:
> In one of my background applications I keep getting a peer communication error stating that a
> timeout occurred on a connection.
> 
> The program runs for most of the day processing background statistics. It has an open "connected"
> connection but not always an active session on that connection, which is why I believe that the
> timeout occurs because it is sitting idle. The timeout is not on a SQL statement or similar, but on
> the idle connection.
> 
> Is there a specific parameter in one of the conf files or elsewhere that would help extend any
> idle/timeout period (I've looked in the documentation but haven't been able to find anything
> specific to connections alone).
> 
> I am using postgres 9.0.4 on Windows XP Home SP3.

I am following a different strategy, you might consider it:

I do a timeout myself and close the connection on inactivity, the app sitting there
on the desktop idle during lunch.

Every use of the connection handle is encapsulated in a proc checking if it is
connected, and connecting if not. I think this is a robust approach that might help
as well with unstable network connections.

/Str.

[toc] | [prev] | [next] | [standalone]


#441

FromJasen Betts <jasen@xnet.co.nz>
Date2013-02-28 11:00 +0000
Message-ID<kgndbu$ggb$2@gonzo.reversiblemaps.ath.cx>
In reply to#439
On 2013-02-28, gargoyle60 <gargoyle60@example.invalid> wrote:
> In one of my background applications I keep getting a peer communication error stating that a
> timeout occurred on a connection.
>
> The program runs for most of the day processing background statistics. It has an open "connected"
> connection but not always an active session on that connection, which is why I believe that the
> timeout occurs because it is sitting idle. The timeout is not on a SQL statement or similar, but on
> the idle connection.
>
> Is there a specific parameter in one of the conf files or elsewhere that would help extend any
> idle/timeout period (I've looked in the documentation but haven't been able to find anything
> specific to connections alone).
>
> I am using postgres 9.0.4 on Windows XP Home SP3.
>
> Thanks

set some keepalives on the cnnection

 http://www.postgresql.org/docs/9.2/interactive/libpq-connect.html#LIBPQ-CONNSTRING

-- 
⚂⚃ 100% natural

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#442

Fromgargoyle60 <gargoyle60@example.invalid>
Date2013-03-01 13:16 +0000
Message-ID<7fa1j8lmnlcug5mt87hf0inohsb7cilva0@4ax.com>
In reply to#439
Thanks for the responses.

Using the libpq functions with connection parameters seems one possible idea. However, I am trying
to keep my application as generic as possible and avoid vendor-specific behaviour inside the
application (it currently uses a façade to handle multi-vendor databases, with postgres as my
preferred choice). 

I suppose I could develop a stored procedure and invoke/call libpq within that, as appropriate?

Presently my application has its own #keepAlive method (simple issues a 'SELECT 1 AS "selected";')
that I can enhance via a fork process to remain active on my connection.

I shall consider both solutions. 

I was hoping for a conf-file parameter, but c'est la vie!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.postgresql


csiph-web