Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D0CED633881 for ; Wed, 12 May 2010 14:16:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 81211-06 for ; Wed, 12 May 2010 17:16:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id B9C3E6338A8 for ; Wed, 12 May 2010 14:16:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o4CHGDhk022518; Wed, 12 May 2010 13:16:13 -0400 (EDT) To: David Schnur cc: pgsql-admin@postgresql.org Subject: Re: Shutdown fails with both 'fast' and 'immediate' In-reply-to: References: <4652.1273674753@sss.pgh.pa.us> Comments: In-reply-to David Schnur message dated "Wed, 12 May 2010 13:03:57 -0400" Date: Wed, 12 May 2010 13:16:13 -0400 Message-ID: <22516.1273684573@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/134 X-Sequence-Number: 34607 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