Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkOMB-0000jf-Bl for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2015 03:28:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZkOMA-0002mb-DE for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2015 03:28:30 +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 1ZkOKq-0001Ko-LF for pgsql-hackers@postgresql.org; Fri, 09 Oct 2015 03:27:08 +0000 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZkOKn-0006G4-71 for pgsql-hackers@postgresql.org; Fri, 09 Oct 2015 03:27:06 +0000 Received: by pabve7 with SMTP id ve7so14449237pab.2 for ; Thu, 08 Oct 2015 20:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=U0uV269GkL0A5pLKSOo96B5Z0+HmfY0Bxohp5OCLSoc=; b=OOC5pyafGc5jnRRTJKQhb/q7Q6j4PeSoQTaxed0iu7NxjiwCreGy4tJJExLhS4i/gm Q6K7xcO8j3xuGdWEu3wfj8UWO3FNTNXICfWsHzEba/bbQLh5n2VMH1V4gWpbcpiiUjYy xzM6xBaDKguxxo+g2iNcbPcXcFZhN8o2SbsXM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=U0uV269GkL0A5pLKSOo96B5Z0+HmfY0Bxohp5OCLSoc=; b=IyrvZ3HQbD3NpZ8YhJ5N6ZeelIyLIucyuHNQXsvq1qpGAGotqsC1i8zYozo5Mvr+sD IEHYoV8VIq2ZxjmPyHTMF6E0Yw+TM5SPQlwywhlLueJsjlv6AlH0EfMi5lD96zw/m3V/ sd/rIX3jB/0iakuV+QKSJxFmlxyZljRt9LxPPYQUQORfvSQe/dmBA1ZjDGtCpaLb3QOh vH+GmdHMzneU5yJG5jL1d0EoEWwpOnCjwE81LsTCGJfrZ0bBpRQZQ0O9SMLx65Dq/DDW PksF8ZP7GBtd2Y5mtZoY8uv5dv8Qz0IusPwMxuYy6pL+fpoDaPhAS1SRXMV8qDZqUdMn /WDg== X-Gm-Message-State: ALoCoQnTrreTr2JZtxiyzR46dLXa8nfM/Ec2dvX8N7EvSMLG9F8/w0amj6hzLL8qM+85pPTGniTk X-Received: by 10.68.90.34 with SMTP id bt2mr12439238pbb.145.1444361223499; Thu, 08 Oct 2015 20:27:03 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id tb9sm48467675pab.13.2015.10.08.20.27.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Oct 2015 20:27:02 -0700 (PDT) Date: Thu, 8 Oct 2015 23:26:49 -0400 From: Noah Misch To: Tom Lane Cc: Tatsuo Ishii , kondo@sraoss.co.jp, pgsql-hackers@postgresql.org Subject: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') Message-ID: <20151009032649.GA62964@tornado.leadboat.com> References: <20150910041518.635.87615@wrigleys.postgresql.org> <20150914.131534.102176843624802952.t-ishii@sraoss.co.jp> <11077.1442205374@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11077.1442205374@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.7 (--) 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 On Mon, Sep 14, 2015 at 12:36:14AM -0400, Tom Lane wrote: > Tatsuo Ishii writes: > >> When pg_ctl tries to connect to postmaster, it uses "0.0.0.0" as the > >> target ip address. Unfortunately "0.0.0.0" is not a valid address on > >> Windows and it fails. Shouldn't pg_ctl translate "0.0.0.0" to > >> "127.0.0.1" in this case? > > > I think this is definitely a bug. I privately heard from the reporter > > that if postmaster is started by not using pg_ctl, it happily starts > > with "listen_addresses = '0.0.0.0'. That means, postmaster itself > > works as advertised, but pg_ctl does not. > > I looked at this before, and could not see anything in either the > postmaster or pg_ctl that would invent the address 0.0.0.0 out of > thin air. I think this report most likely depends on some > misconfiguration of the OP's system. I doubt it should be our business > to work around such misconfiguration. Use of "0.0.0.0" or "::" as a socket destination address is not portable. The Windows connect() documentation says, "If the address member of the structure specified by the name parameter is filled with zeros, connect will return the error WSAEADDRNOTAVAIL." OpenBSD 5.0 behaves the same way. NetBSD 6.0 does not accept ::, but it accepts 0.0.0.0. (For this to affect pg_ctl on non-Windows platforms, you would need to empty unix_socket_directories.) > In particular, magically > substituting 127.0.0.1 for 0.0.0.0 seems utterly without principle. Binding a listening socket to "0.0.0.0" listens on every local IPv4 address, and 127.0.0.1 is one of those addresses. That's the principle. It's inelegant, but I expect it to work everywhere. nm -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers