Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option

Поиск
Список
Период
Сортировка
От Christoph Berg
Тема Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
Дата
Msg-id 20180910140301.GF20917@msg.df7cb.de
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
Список pgsql-bugs
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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15377: SLES 11