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: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: 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-12 14:08:45
Message-ID: 201011121408.oACE8jJ27781@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Magnus Hagander wrote:
> On Fri, Nov 12, 2010 at 03:49, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Magnus Hagander wrote:
> >> On Fri, Sep 17, 2010 at 05:51, Ashesh Vashi
> >> <ashesh(dot)vashi(at)enterprisedb(dot)com> wrote:
> >> > Hi Mark,
> >> >
> >> > On of my college (Sujeet) has found a way to reproduce the same behaviour.
> >> > 1. Installed PG 9.0 on Win XP SP3
> >> > 2. Stop the Postgresql-9.0 service from service manager console
> >> > 3. Create pgpass.conf in postgres (service account) user's profile with an
> >> > incorrect password deliberately.
> >> > (Refer: http://www.postgresql.org/docs/8.4/interactive/libpq-pgpass.html)
> >> > 4. Now start the postgresql-9.0 service, it will return an error and the
> >> > status
> >> > ?? shows stopped
> >> > 5. However i could connect to the psql shell and get the prompt which means
> >> > ??? the server is running.
> >>
> >> I took a quick look at the code, and from what I can tell this is
> >> because PQconnectionNeedsPassword() always returns false if a
> >> pgpass.conf has been used. There is no handling the case where pgpass
> >> is used, but has an incorrect password.
> >>
> >> Does anybody recall the specific reason for this? Do we need a way for
> >> pg_ctl to figure this out, or do we need to change it in
> >> PQconnecitonNeedsPassword()?
> >
> > I was not able to reproduce this failure on my BSD system using GIT
> > head:
> >
> > ? ? ? ?$ psql test
> > ? ? ? ?psql: FATAL: ?password authentication failed for user "postgres"
> > ? ? ? ?password retrieved from file "/u/postgres/.pgpass"
> >
> > ? ? ? ?$ pg_ctl status
> > ? ? ? ?pg_ctl: server is running (PID: 710)
> > ? ? ? ?/usr/var/local/pgsql/bin/postgres "-i"
>
> The problem is not in pg_ctl status, it's in pg_ctl start. They're
> different codepaths - status never tries to actually connect, it just
> checks if the process is alive.

Uh, I still cannot reproduce the failure:

$ psql postgres
psql: FATAL: password authentication failed for user "postgres"
password retrieved from file "/u/postgres/.pgpass"

$ pg_ctl stop
waiting for server to shut down.... done
server stopped

$ pg_ctl -l /dev/null start
server starting

(Got to love that new 9.0 pgpass error message.)

--
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 Michael Feldmann 2010-11-12 14:19:01 BUG #5751: pg_restore does not work correctly with BLOBs
Previous Message Heikki Linnakangas 2010-11-12 13:32:23 Re: BUG #5750: dropping objects owned by user fails

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-11-12 14:17:20 Re: We need index-only scans
Previous Message Markus Wanner 2010-11-12 14:07:27 Re: multi-platform, multi-locale regression tests