Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 327BE64FC04 for ; Mon, 22 Sep 2008 12:40:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08855-05 for ; Mon, 22 Sep 2008 12:39:57 -0300 (ADT) X-Greylist: delayed 00:33:18.434388 by SQLgrey-1.7.6 Received: from easy2.in-chemnitz.de (easy2.in-chemnitz.de [88.198.17.232]) by postgresql.org (Postfix) with ESMTP id D036764FC0D for ; Mon, 22 Sep 2008 12:39:56 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by easy2.in-chemnitz.de (Postfix) with ESMTP id 3995247000B for ; Mon, 22 Sep 2008 17:06:34 +0200 (CEST) Received: from easy2.in-chemnitz.de ([127.0.0.1]) by localhost (easy.in-chemnitz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cB0kD39tpiuQ for ; Mon, 22 Sep 2008 17:06:34 +0200 (CEST) Received: by easy2.in-chemnitz.de (Postfix, from userid 1013) id 289BE470007; Mon, 22 Sep 2008 17:06:34 +0200 (CEST) Date: Mon, 22 Sep 2008 17:06:34 +0200 From: Tino Schwarze To: pgsql-admin@postgresql.org Subject: Re: SIGKILL and force disconnecting user sessions Message-ID: <20080922150634.GE10876@easy2.in-chemnitz.de> References: <1222091009.3153.84.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1222091009.3153.84.camel@soundwave.ws.pitbpa0.priv.collaborativefusion.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/230 X-Sequence-Number: 30323 On Mon, Sep 22, 2008 at 09:43:29AM -0400, Brian A. Seklecki wrote: BTW: What version of PG are you using? > We need to kill apache P-conn pools from a an application/web server > cluster for a specific database. We use a load-balancer, so we shut > down the HA L4 Service VIP that the web servers pconnect() to, to > prevent new incoming connections. > > The problem is then net.inet.tcp.* timeouts. We need to cane existing > connections with a quickness, and pg_stat_activity is a read-only view. > > We need to kill the stale pcons, so just: > $ pkill -a [database string] > > The connection goes away as "Disconnected per admin command" > > I just want to confirm: > > 1) There are no data consistency threats to SIGKIL a child thread > process? Transactions and locks will be handled gracefully? As far, as you do not really use SIGKILL (9), but SIGTERM (15), everything should be fine. > 2) There are no pgsql/admin level CLI builtin commands to do this in a > more graceful manor? You might want to try pg_cancel_backend(pid) to cancel backends, but I suppose, the connection will stay alive. - see http://www.postgresql.org/docs/8.2/static/functions-admin.html HTH, Tino. -- "What we nourish flourishes." - "Was wir nähren erblüht." www.craniosacralzentrum.de www.forteego.de