Re: pg_ctl reports succes when start fails

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To:
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_ctl reports succes when start fails
Date: 2003-10-24 14:18:45
Message-ID: 3F9934C5.2020104@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32

Peter Eisentraut wrote:

>Tom Lane writes:
>
>
>
>>I also wonder why -w isn't the default.
>>
>>
>
>Because it is not sufficiently reliable in start mode. See
>source code and archives.
>
>
>

I think we can improve -w, though. Here's what the code says about the
section where it tries to use psql to determine that the postmaster is
up and running:

# FIXME: This is horribly misconceived.
# 1) If password authentication is set up, the connection will fail.
# 2) If a virtual host is set up, the connection may fail.
# 3) If network traffic filters are set up tight enough, the connection
# may fail.
# 4) When no Unix domain sockets are available, the connection will
# fail. (Using TCP/IP by default ain't better.)
# 5) If the dynamic loader is not set up correctly (for this user/at
# this time), psql will fail (to find libpq).
# 6) If psql is misconfigured, this may fail.

we could provide a password option to handle 1, and in C we can make the
connection ourselves using libpq instead of relying on psql to do it for
us, which should account for 5 and 6, I think.

For the cases of 2, 3 and 4 we can either try to detect it from the
configuration settings, or suggest that users will need to use -W for
such cases. To me it would be strange to have a setup where no
connection from the machine where pg is running is possible, but maybe
people do such odd things.

We can also try to come up with a better scheme for verifying that we
have started properly - I will think about that.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adam Witney 2003-10-24 14:19:36 Re: shared memory on OS X - 7.4beta4
Previous Message Bruce Momjian 2003-10-24 14:10:33 Re: 7.4 compatibility question

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2003-10-27 15:22:32 Defaults for GUC variables (was Re: pg_ctl reports succes when start fails)
Previous Message Peter Eisentraut 2003-10-24 12:35:12 Re: pg_ctl reports succes when start fails