pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Berg <myon@debian.org>
To: tomek@pipebreaker.pl, Sebastian Elisa Pfeifer <s.pfeifer@ixolit.com>
To: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
Date: Mon, 10 Sep 2018 15:33:09 +0200
Message-ID: <20180910133309.GE20917@msg.df7cb.de> (raw)
In-Reply-To: <20180907143718.GF29573@msg.df7cb.de> <20151203165520.5892.4072@wrigleys.postgresql.org>

Re: tomek@pipebreaker.pl 2015-12-03 <20151203165520.5892.4072@wrigleys.postgresql.org>
> Bug reference:      13793
> Logged by:          Tomasz Torcz
> Email address:      tomek@pipebreaker.pl
> PostgreSQL version: 9.4.5
> Operating system:   Linux
> Description:        
> 
> IP_FREEBIND socket option allows application to bind on IP address, which i
> s not (yet) configured on any interface. 
> I'd like to see Postgresql binding to all specified 'listen_addresses', even
> if some of then are not available at the moment pgsql starts.
> Optionally, postmaster could put in logs information about that action.
> Right know it is:
> 
> LOG:  could not bind IPv6 socket: Cannot assign requested address
> WARNING:  could not create listen socket for "2001:DB8::1"
> 
> It could be:
> LOG:  could not bind IPv6 socket: Cannot assign requested address
> WARNING:  binding anyway to "2001:DB8::1"

Re: To Sebastian Elisa Pfeifer 2018-09-07 <20180907143718.GF29573@msg.df7cb.de>
> Re: Sebastian Elisa Pfeifer 2018-09-07 <ab23ab6a-f54a-4063-be3d-dbc93f5dedd2@ixolit.com>
> > |2018-09-06 14:02:32 UTC LOG: could not bind IPv4 socket: Cannot assign
> > requested address 2018-09-06 14:02:32 UTC HINT: Is another postmaster
> > already running on port 5432? If not, wait a few seconds and retry.
> > 2018-09-06 14:02:32 UTC WARNING: could not create listen socket for
> > "123.123.123.123"|
> > 
> > Possible fix: Adding the parameter After=network-online.target to it's
> > SystemD Unit file.
> > 
> > Our setup includes the setting:
> > listen_addresses = 'localhost,123.123.123.123' (not the real IP)
> 
> Hi,
> 
> thanks for the report.
> 
> I'll have to investigate if that's the correct fix in general. Afaict
> network-online.target does less than what the name says, i.e. some
> interfaces might still be configuring even at that point. Usual
> symptoms are IPv6 devices that are still in address discovery.

According to https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ ,
network-online.target is meant to be used for networking clients that
need to actually access the network. For daemons that merely provide
networking services, the suggested solution is to enable IP_FREEBIND
on the socket:

http://man7.org/linux/man-pages/man7/ip.7.html

       IP_FREEBIND (since Linux 2.4)
              If enabled, this boolean option allows binding to an IP
              address that is nonlocal or does not (yet) exist.  This per‐
              mits listening on a socket, without requiring the underlying
              network interface or the specified dynamic IP address to be up
              at the time that the application is trying to bind to it.
              This option is the per-socket equivalent of the ip_nonlo‐
              cal_bind /proc interface described below.

This had been requested in 2015 in bug #13793. I think it makes sense
to support this. Especially with IPv6, it is very common that
addresses are not yet assigned when services are starting. (I don't
know yet if other OSes support this option as well.)

Do we want that in PostgreSQL?

Christoph




view thread (6+ messages)  latest in thread

Message-ID: <20180910133309.GE20917@msg.df7cb.de>
Permalink:  ../20180910133309.GE20917@msg.df7cb.de/
Also on:    postgresql.org/message-id/20180910133309.GE20917@msg.df7cb.de

 · 

reply

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, s.pfeifer@ixolit.com
  Subject: Re: [BUGS] BUG #13793: Please implement IP_FREEBIND option
  In-Reply-To: <20180910133309.GE20917@msg.df7cb.de>
  References: <20180910133309.GE20917@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