Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7B1BD6334F0 for ; Wed, 12 May 2010 17:21:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 80140-03 for ; Wed, 12 May 2010 20:21:48 +0000 (UTC) X-Greylist: delayed 00:17:59.256759 by SQLgrey-1.7.6 Received: from thor.cwgsy.net (thor.cwgsy.net [212.30.8.68]) by mail.postgresql.org (Postfix) with ESMTP id 3E4C06334D0 for ; Wed, 12 May 2010 17:21:49 -0300 (ADT) Received: from localhost (unknown [127.0.0.1]) by thor.cwgsy.net (Postfix) with ESMTP id 2F103508008 for ; Wed, 12 May 2010 21:03:47 +0100 (BST) Received: from thor.cwgsy.net ([127.0.0.1]) by localhost (thor.cwgsy.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jEBH9eZRIKi7 for ; Wed, 12 May 2010 21:03:43 +0100 (BST) Received: from mail.cwgsy.net (unknown [100.0.0.212]) by thor.cwgsy.net (Postfix) with ESMTP id CC71D50805B for ; Wed, 12 May 2010 21:03:43 +0100 (BST) Received: from Demolish2 [80.73.209.184] by cwgsy.net (SMTPD-10.0) id A9070EB4; Wed, 12 May 2010 21:01:11 +0100 Message-ID: From: "Donald Fraser" To: "[ADMIN]" References: <4652.1273674753@sss.pgh.pa.us> <22516.1273684573@sss.pgh.pa.us> Subject: Re: Shutdown fails with both 'fast' and 'immediate' Date: Wed, 12 May 2010 21:03:44 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.154 tagged_above=-10 required=5 tests=BAYES_05=-0.5, STOX_REPLY_TYPE=0.439, TVD_FINGER_02=1.215 X-Spam-Level: * X-Archive-Number: 201005/135 X-Sequence-Number: 34608 ----- Original Message ----- Subject: Re: [ADMIN] Shutdown fails with both 'fast' and 'immediate' > David Schnur writes: >> I'm less concerned with the particular query than with the general >> question >> of when a shutdown could hang like this. I expected this to be possible >> when using -m fast, but my understanding was that -m immediate really >> forced >> termination. > > Yeah, it's supposed to. The sequence is pg_ctl -m immediate sends > SIGQUIT to the postmaster, which in turn sends SIGQUIT to all its child > processes, and their SIGQUIT interrupt handlers just immediately exit(). > I was thinking earlier that there might be a bug in the postmaster state > machine that prevented it from sending SIGQUIT if it had already > received SIGTERM (-m fast), but a look at the sources doesn't support > that theory. The only obvious theory at this point is that the backend > is stuck in some uninterruptable kernel call, but it's hard to imagine > what. > > Is the postmaster still there after -m immediate, or does it quit? > If it's still there, maybe there's some problem in the earlier part > of the sequence. > > A gdb stack trace from whichever processes are still there after -m > immediate could be informative. Another thing you could try is a > manual "kill -QUIT pid" on the uncooperative backend(s). > > regards, tom lane Just to add some more comments on similar observations. We have a restore script that restores a database from a backup (pg_dump). The only users connected during the restore are postgres on localhost. In the script we use pg_ctl stop -D $PGDATA -m immediate to stop the database and have noted that this doesn't always work. We recently upgraded from 8.1 to 8.3 and have never previously noticed this issue. The main difference in our configuration between 8.1 and 8.3 is that we now have "autovacuum = on". So for what its worth, the DELETE might be a "red herring". Given our circumstance, I would be more inclined to think the issue is something to do with autovacuum as there are no DELETE statements in our restore procedure and we don't execute pg_ctl stop untill all statements are complete. Regards Donald Fraser