Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A7F30133798E for ; Fri, 24 Sep 2010 17:31:01 -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 78160-01 for ; Fri, 24 Sep 2010 20:30:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.121]) by mail.postgresql.org (Postfix) with ESMTP id CACB11336FA7 for ; Fri, 24 Sep 2010 17:30:53 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=wTjIA1p3qEL6BHsxIdbxLRmJbRw8bYnSlt30XKMhSVA= c=1 sm=0 a=P_pzE1zw__sA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=KemSYLhRAAAA:8 a=6ulcWk99h_WvRStMoVgA:9 a=Y2w422aCEAtkVjm8xcKt7KRlLhQA:4 a=wPNLvfGTeEIA:10 a=IvWp0zEv-XEA:10 a=0ICmrwUgjjWLZ4Tbh00A:9 a=Gj3D7WwzmFRkDNUBqajkmJ6KgBQA:4 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:34707] helo=[192.168.10.104]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id 9D/D2-13838-C7A0D9C4; Fri, 24 Sep 2010 20:30:53 +0000 Message-ID: <4C9D0A7C.80400@dunslane.net> Date: Fri, 24 Sep 2010 16:30:52 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.3 MIME-Version: 1.0 To: Tom Lane CC: Magnus Hagander , 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 References: <201009091622.o89GMp0V012822@wwwmaster.postgresql.org> <13967.1285337095@sss.pgh.pa.us> <4C9CB8E8.3040106@dunslane.net> <25617.1285341066@sss.pgh.pa.us> In-Reply-To: <25617.1285341066@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------000500030903030705000900" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201009/1741 X-Sequence-Number: 170605 This is a multi-part message in MIME format. --------------000500030903030705000900 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 09/24/2010 11:11 AM, Tom Lane wrote: > Andrew Dunstan writes: >> On 09/24/2010 10:15 AM, Magnus Hagander wrote: >>> In that case, we should probably teach pg_ctl about this case, no? >>> Since it clearly gives an incorrect message to the user now... >> pg_ctl decides that the server is running iff it can connect to it. Do >> you intend to provide for a different test? > Seems like getting a password challenge from the server is sufficient > evidence that the server is running, whether we are able to meet the > challenge or not. Perhaps we could just twiddle pg_ctl's "is it up" > test a bit to notice whether the connect failure was of this sort. pg_ctl does in fact use that sort of logic: if ((conn = PQconnectdb(connstr)) != NULL && (PQstatus(conn) == CONNECTION_OK || PQconnectionNeedsPassword(conn))) But of course, libpq won't set that last condition if there is a bad password in the pgpass file, which seems a rather perverse thing to do. cheers andrew --------------000500030903030705000900 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

On 09/24/2010 11:11 AM, Tom Lane wrote:
Andrew Dunstan <andrew@dunslane.net> writes:
On 09/24/2010 10:15 AM, Magnus Hagander wrote:
In that case, we should probably teach pg_ctl about this case, no?
Since it clearly gives an incorrect message to the user now...

      
pg_ctl decides that the server is running iff it can connect to it. Do 
you intend to provide for a different test?
Seems like getting a password challenge from the server is sufficient
evidence that the server is running, whether we are able to meet the
challenge or not.  Perhaps we could just twiddle pg_ctl's "is it up"
test a bit to notice whether the connect failure was of this sort. 

pg_ctl does in fact use that sort of logic:

if ((conn = PQconnectdb(connstr)) != NULL &&
      (PQstatus(conn) == CONNECTION_OK ||
       PQconnectionNeedsPassword(conn)))

But of course, libpq won't set that last condition if there is a bad password in the pgpass file, which seems a rather perverse thing to do.

cheers

andrew
--------------000500030903030705000900--