pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reiner Dassing <dassing@wettzell.ifag.de>
To: Tim White <twhite@friendlyworks.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: killing old connections
Date: Thu, 08 Jun 2000 17:05:13 +0200
Message-ID: <393FB629.A6DCBAA3@wettzell.ifag.de> (raw)
References: <NDBBLLDBAKLDCHKABIAECEBHCBAA.twhite@friendlyworks.com>

Hello Tim!


Tim White wrote:
> 
> Is there a way to view the active/inactive connections to PostgreSQL 6.5.3?

I have the same problems, but I solved it by using the following
algorithm:

1. Get a list all processes of the postmaster by
   ps -u postgres | grep /usr/local/pgsql/bin/postmaster

2. If there is just 1 process, finish

3. Determine the pid's (Process IDs) of all the processes of step 1

4. Determine the PPIDs (Parent PIDs) of all processes, by
   ps -p PID -o ppid    
   (well, this line is for Tru64; you have to ask your man page for your
switches)

5. Determine the process which is the father of all your processes,
   this is the one which has as its father the PID 1

   The father postmaster so to say is not the process you should look at
   during the further steps.

6. For all the other PIDs do
   - determine the elapsed sleeping time and ist state
     by    ps -p PID -o etime,sl,state (under Tru64)
   - if the sleeping time is greater than ??? hours (or minutes)
     kill it by 'kill PID'

This algorithm was implemented in PERL and is running every hour
via cron.

Maybe that helps    

> And if so is it possible to kill those that are inactive?  I'm having
> difficulty in testing using a Java application, where connections are
> established and then not being destroyed properly.  This causes me to get an
> error message stating that there are "...too many clients already.".
> 
> Any help is greatly appreciated.
> 
> Tim White

--
Mit freundlichen Gruessen / With best regards
   Reiner Dassing



view thread (3+ messages)

Message-ID: <393FB629.A6DCBAA3@wettzell.ifag.de>
Permalink:  ../393FB629.A6DCBAA3@wettzell.ifag.de/
Also on:    postgresql.org/message-id/393FB629.A6DCBAA3@wettzell.ifag.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: dassing@wettzell.ifag.de, twhite@friendlyworks.com
  Subject: Re: killing old connections
  In-Reply-To: <393FB629.A6DCBAA3@wettzell.ifag.de>
  References: <NDBBLLDBAKLDCHKABIAECEBHCBAA.twhite@friendlyworks.com> <393FB629.A6DCBAA3@wettzell.ifag.de>

* 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