Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Magnus Hagander <magnus(at)hagander(dot)net>, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>, Mark Llewellyn <mark_llewellyn(at)adp(dot)com>, pgsql-hackers(at)postgresql(dot)org, Sujeet Rajguru <sujeet(dot)rajguru(at)enterprisedb(dot)com>
Subject: Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running
Date: 2010-11-25 18:11:44
Message-ID: 201011251811.oAPIBiP21864@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs 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 start
waiting for server to start.... done
server started
warning: could not connect, perhaps due to invalid authentication or
misconfiguration.

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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2010-11-26 01:45:55 Re: BUG #5767: Memory Leak
Previous Message Tom Lane 2010-11-25 16:52:49 Re: BUG #5770: Foreign key violation after insert

Browse pgsql-hackers by date

  From Date Subject
Next Message Maciek Sakrejda 2010-11-25 18:20:34 Re: [JDBC] JDBC and Binary protocol error, for some statements
Previous Message Bruce Momjian 2010-11-25 17:57:27 Re: problem with Win32 buildfarm