Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C15C71337B56 for ; Wed, 17 Nov 2010 15:21:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 71936-05 for ; Wed, 17 Nov 2010 19:21:50 +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 1EF6F133616B for ; Wed, 17 Nov 2010 15:21:49 -0400 (AST) 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 oAHJLjV8017546; Wed, 17 Nov 2010 14:21:45 -0500 (EST) To: Magnus Hagander cc: Bruce Momjian , Ashesh Vashi , Mark Llewellyn , pgsql-hackers@postgresql.org, Sujeet Rajguru Subject: Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running In-reply-to: References: <201011171857.oAHIvJr19227@momjian.us> Comments: In-reply-to Magnus Hagander message dated "Wed, 17 Nov 2010 20:07:52 +0100" Date: Wed, 17 Nov 2010 14:21:44 -0500 Message-ID: <17545.1290021704@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/1096 X-Sequence-Number: 174239 Magnus Hagander writes: > On Wed, Nov 17, 2010 at 19:57, Bruce Momjian wrote: >> Is FATAL, in general, enough to conclude the server is running? > No - specifically, we will send FATAL when "the database system is > starting up", which is exactly the one we want to *avoid*. > I think we should only exclude the password case. I guess we could > also do all fatal *except* , but that seems more fragile. I believe that the above argument is exactly backwards. What we want here is to check the result of postmaster.c's canAcceptConnections(), and there are only a finite number of error codes that can result from rejections there. If we get past that, there are a large number of possible failures, but all of them indicate that the postmaster is in principle willing to accept connections. Checking for password errors only is utterly wrong: any other type of auth failure would be the same for this purpose, as would "no such database", "no such user", "too many connections", etc etc etc. What we actually want here, and don't have, is the fabled pg_ping protocol... regards, tom lane