pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rushabh Doshi <rdoshi@vmware.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris <dmagick@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: db sever seems to be dropping connections
Date: Tue, 21 Mar 2006 13:39:55 -0800
Message-ID: <428B5EAB52D41B48BFE2D7D21C522D2B7C97EF@PA-EXCH01.vmware.com> (raw)

Tom,

This is my problem. I have a connection to the database using DB->connect.
Apparently, this connection sits idle for around an hour or so because of my
application, and after that it has to do something. So I check that if the
handle is still a valid one or not. If it's not, then re-establish the
connection and use that handle. This works fine. However, when the time comes
to destroy all the handles, the first handle (stale) seems to be throwing
warning/error messages on exit.

DBI handle: DBI::db=HASH(0x907045c)  # this is the latest handle
result of disconnect: 1
DBI handle: DBI::db=HASH(0x9480bdc)  # this is the stale handle
DBD::Pg::db disconnect failed: rollback failed at *** line 241.
result of disconnect:
disconnect failed for DBI::db=HASH(0x9480bdc):  DBD::Pg::db disconnect
failed: rollback failed at *** line 241. 

I've used evals in the DESTROY to avoid these messages. Still this keeps
happening. I've tried using connect_cached but to no effect.

Thanks,
--Rushabh Doshi

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
Sent: Monday, March 20, 2006 2:16 PM
To: Chris
Cc: Rushabh Doshi; pgsql-general@postgresql.org
Subject: Re: [GENERAL] db sever seems to be dropping connections 

Chris <dmagick@gmail.com> writes:
> Rushabh Doshi wrote:
>> I'm facing an issue with PostgreSQL .. The server seems to drop the 
>> connection to my script after a couple of hours (sometimes, not always).

> Sounds more like a network issue.

Yeah --- in particular, it sounds like a connection timeout imposed by a
router or firewall.  A lot of NAT-capable routers will drop idle TCP
connections after a certain period of inactivity (typically an hour or so ...
if you're lucky, the router will let you adjust the timeout).
There is no connection timeout built into Postgres itself, so you should be
looking for network-related limitations.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <428B5EAB52D41B48BFE2D7D21C522D2B7C97EF@PA-EXCH01.vmware.com>
Permalink:  ../428B5EAB52D41B48BFE2D7D21C522D2B7C97EF@PA-EXCH01.vmware.com/
Also on:    postgresql.org/message-id/428B5EAB52D41B48BFE2D7D21C522D2B7C97EF@PA-EXCH01.vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rdoshi@vmware.com, tgl@sss.pgh.pa.us, dmagick@gmail.com, pgsql-general@postgresql.org
  Subject: Re: db sever seems to be dropping connections
  In-Reply-To: <428B5EAB52D41B48BFE2D7D21C522D2B7C97EF@PA-EXCH01.vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox