Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zln83-0000FB-UG for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Oct 2015 00:07:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zln82-0001T4-V1 for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Oct 2015 00:07:43 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zln82-0001So-2u for pgsql-hackers@postgresql.org; Tue, 13 Oct 2015 00:07:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zln7z-0005kT-Jv; Tue, 13 Oct 2015 00:07:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t9D07bnw001816; Mon, 12 Oct 2015 20:07:37 -0400 From: Tom Lane To: Robert Haas cc: Noah Misch , Tatsuo Ishii , kondo@sraoss.co.jp, "pgsql-hackers@postgresql.org" Subject: Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') In-reply-to: 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> <20151010021651.GA85148@tornado.leadboat.com> Comments: In-reply-to Robert Haas message dated "Mon, 12 Oct 2015 19:37:42 -0400" Date: Mon, 12 Oct 2015 20:07:37 -0400 Message-ID: <1815.1444694857@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > On Fri, Oct 9, 2015 at 10:16 PM, Noah Misch 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