From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Tatsuo Ishii <ishii@postgresql.org>
Cc: kondo@sraoss.co.jp, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Subject: Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')
Date: Mon, 12 Oct 2015 20:07:37 -0400
Message-ID: <1815.1444694857@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmobJ2ntJ8qU69LdemHhSKtC+8cMOVc5Wncmd1DdXbjLOGw@mail.gmail.com>
References: <20150910041518.635.87615@wrigleys.postgresql.org>
<20150914.131534.102176843624802952.t-ishii@sraoss.co.jp>
<11077.1442205374@sss.pgh.pa.us>
<20151009032649.GA62964@tornado.leadboat.com>
<CA+TgmoYfnf=pQKBa5khLf9RH_SkmMEn2miqmoJ-GTXeHNcVULg@mail.gmail.com>
<20151010021651.GA85148@tornado.leadboat.com>
<CA+TgmobJ2ntJ8qU69LdemHhSKtC+8cMOVc5Wncmd1DdXbjLOGw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Oct 9, 2015 at 10:16 PM, Noah Misch <noah@leadboat.com> wrote:
>> The listening side is in good shape today. This thread is about the address
>> that pg_ctl uses in PQping("host=..."). Listening on 0.0.0.0 is portable.
>> PQping("host='0.0.0.0'") relies on non-portable semantics in the underlying
>> connect() syscall. PQping("host='127.0.0.1'") is a portable substitute.
> Ah. So in this case 0.0.0.0 is interpreted to mean "any IP that's a
> way to reach the local host", and using 127.0.0.1 makes sense because
> we know that will always be one of them? I could buy that line of
> reasoning.
I do *not* buy that we can safely replace "localhost" by "127.0.0.1".
Consider a system that's only set up with IPv6 local addressing.
AFAICS the complaint in this bug is about a system with broken DNS (ie,
unable to resolve "localhost" properly, which is something mandated by
relevant RFCs, I believe). We should not break legally, if perhaps
strangely, configured systems in order to work around a misconfigured one.
Failure to resolve localhost to a working loopback address will break a
lot of services besides ours, so the OP is going to need to fix the
configuration problem eventually anyway.
BTW, it looks like pgstat.c will work in such a case, but it's only
accidentally so; as Noah notes, listening to 0.0.0.0 works, and then
it looks like we get the actual IP address for backends to connect to
from the listen socket itself. That wasn't a situation that the code
was meant to handle, for sure, and I wouldn't want to bet that it would
work like that on every platform.
Now, if you're proposing trying "localhost" and falling back to 127.0.0.1
if it fails to resolve, that would be OK with me --- but it would be a
significant amount of additional complexity for what remains a case I do
not think we need to support.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, noah@leadboat.com, ishii@postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')
In-Reply-To: <1815.1444694857@sss.pgh.pa.us>
References: <20150910041518.635.87615@wrigleys.postgresql.org> <20150914.131534.102176843624802952.t-ishii@sraoss.co.jp> <11077.1442205374@sss.pgh.pa.us> <20151009032649.GA62964@tornado.leadboat.com> <CA+TgmoYfnf=pQKBa5khLf9RH_SkmMEn2miqmoJ-GTXeHNcVULg@mail.gmail.com> <20151010021651.GA85148@tornado.leadboat.com> <CA+TgmobJ2ntJ8qU69LdemHhSKtC+8cMOVc5Wncmd1DdXbjLOGw@mail.gmail.com> <1815.1444694857@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox