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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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-16 11:39:35
Message-ID: AANLkTi=oUxVMeNs57movi0SPwzAWzDHA8XVQx9C3FitU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Fri, Nov 12, 2010 at 17:47, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Tom Lane wrote:
>> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> > Uh, I still cannot reproduce the failure:
>>
>> I would imagine you need -w option on the start.  The whole issue
>> here is whether start's wait-for-server-start code works.
>
> Thanks, I am now able to reproduce this.  I was able to get this to
> report the .pgpass problem:
>
>        $ 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 -w -l /dev/null start
>        waiting for server to start....FATAL:  password authentication failed
>        for user "postgres"
>        password retrieved from file "/u/postgres/.pgpass"
>        .FATAL:  password authentication failed for user "postgres"
>        password retrieved from file "/u/postgres/.pgpass"
>        .FATAL:  password authentication failed for user "postgres"
>        password retrieved from file "/u/postgres/.pgpass"
>        .^C
>
> I basically report the connection error string if it starts with "FATAL:".
>
> I originally tried to check for an ERRCODE_INVALID_PASSWORD error field
> (see // comments), but it seems there is no way to access this, i.e.
> PQgetResult(conn) on a connection failure is always NULL.
>
> Anyway, perhaps FATAL is a better test because it will report any major
> failure, not just a .pgpass one.
>
> Patch attached.

Bad Bruce, using C++ comments like that :P And non-context diff ;)

Does this actually solve the *problem*, though? The problem is not
what is reported on stdout/stderr, the problem is that the net result
is that the server is reported as not started (by the service control
manager) when it actually *is* started. In this case, stderr doesn't
even go anywhere. What happens if you *don't* Ctrl-C it?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Fetter 2010-11-16 14:35:30 Re: BUG #5754: CTE optimization fails to account for side effects
Previous Message Tom Lane 2010-11-15 23:55:47 Re: BUG #5754: CTE optimization fails to account for side effects

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2010-11-16 11:45:29 Re: Isn't HANDLE 64 bits on Win64?
Previous Message Alexander Korotkov 2010-11-16 11:07:58 Re: Fix for seg picksplit function