On Sun, Sep 30, 2012 at 5:41 PM, Nathan Wagner <nw@hydaspes.if.org> wrote:
> On Sun, Sep 30, 2012 at 06:54:35PM +0200, Levente Kovacs wrote:
>> I've been using PostgreSQL for quite while, but I'd need some direction on
>> how to handle an opened socket to the database in longer periods.
>>
>> I open the connection to my database with PQconnectdb().
>>
>> I access the database, everything is fine. However, if I don't access the
>> database for a long time (measured in days), the connection is broken. I
>> get this error message:
>>
>> SQL action failed: 'FATAL: terminating connection due to administrator
>> command SSL connection has been closed unexpectedly.
>
> Are you setting keepalives on the connection? They should be on
> by default, but it's worth checking. Perhaps they don't
> cooperate with SSL somehow.
I've had problems with ssl connections dying on me. For slony
replication I had to make sure the connections were NOT ssl or they'd
die and subscriptions would just keep repeating after getting 80%
through and getting a connect error. This was with 8.4 on debian
lenny.