From: Christoph Berg <myon@debian.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: tomek@pipebreaker.pl, Sebastian Elisa Pfeifer <s.pfeifer@ixolit.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
Date: Mon, 10 Sep 2018 16:03:01 +0200
Message-ID: <20180910140301.GF20917@msg.df7cb.de> (raw)
In-Reply-To: <9118.1536587267@sss.pgh.pa.us>
References: <20180910133309.GE20917@msg.df7cb.de>
<9118.1536587267@sss.pgh.pa.us>
Re: Tom Lane 2018-09-10 <9118.1536587267@sss.pgh.pa.us>
> > Do we want that in PostgreSQL?
>
> IIRC, the main concern expressed previously is that this would completely
> defeat error checking on the listen_addresses parameter. However, that
> doesn't apply if said parameter is "*". Would there be any sense in
> applying IP_FREEBIND only for "*"?
"*" should work always, so IP_FREEBIND shouldn't make any difference.
In the meantime I found https://bugzilla.redhat.com/show_bug.cgi?id=1357199
(from July 2016) where the problem had been discussed before.
Re error checking, the state at the moment is actually worse than it
would be with IP_FREEBIND. If multiple addresses are configured, and
only one of them fails, there is no error, and startup proceeds:
listen_addresses = 'localhost,1.2.3.4'
LOG: listening on IPv6 address "::1", port 5432
LOG: listening on IPv4 address "127.0.0.1", port 5432
LOG: could not bind IPv4 address "1.2.3.4": Cannot assign requested address
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "1.2.3.4"
So unless the user checks the log, everything seems fine, but actually
the socket is unreachable. With IP_FREEBIND, we could still log a
WARNING first, and then proceed with binding.
With only one IP configured, there is an ERROR:
LOG: could not bind IPv4 address "1.2.3.4": Cannot assign requested address
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "1.2.3.4"
FATAL: could not create any TCP/IP sockets
I think it is a bug that these cases behave differently.
I'd opt to apply IP_FREEBIND (and hopefully the equivalent on other
kernels), and log a WARNING. Binding to a IP that is not assigned is
also an important use-case in HA setups that have a virtual (floating)
IP.
Christoph
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: myon@debian.org, tgl@sss.pgh.pa.us, s.pfeifer@ixolit.com
Subject: Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
In-Reply-To: <20180910140301.GF20917@msg.df7cb.de>
References: <20180910133309.GE20917@msg.df7cb.de> <9118.1536587267@sss.pgh.pa.us> <20180910140301.GF20917@msg.df7cb.de>
* 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