Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running
Date
Msg-id 201011251811.oAPIBiP21864@momjian.us
Whole thread Raw
In response to Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running
List pgsql-hackers
Bruce Momjian wrote:
> > > BTW, it is annoying that we can't definitively distinguish "postmaster
> > > is not running" from a connectivity problem, but I can't see a way
> > > around that.
> > 
> > Agreed.  I will research this.
> 
> I have researched this and developed the attached patch.  It implements
> PGping() and PGpingParams() in libpq, and has pg_ctl use it for pg_ctl
> -w server status detection.
> 
> The new output for cases where .pgpass is not allowing for a connection
> is:
> 
>     $ pg_ctl -w -l /dev/null start
>     waiting for server to start.... done
>     server started
>     However, could not connect, perhaps due to invalid authentication or
>     misconfiguration.
> 
> The code basically checks the connection status between PQconnectStart()
> and connectDBComplete() to see if the server is running but we failed to
> connect for some reason.

I have applied this patch, with modified wording of the "cannot connect"
case:
$ pg_ctl -w -l /dev/null startwaiting for server to start.... doneserver startedwarning:  could not connect, perhaps
dueto invalid authentication ormisconfiguration.
 

I assume having the warning as the last printed things is appropriate. 
This is my second patch this week that got little feedback --- I am
getting a little spooked.  ;-)

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: problem with Win32 buildfarm
Next
From: Maciek Sakrejda
Date:
Subject: Re: [JDBC] JDBC and Binary protocol error, for some statements