Обсуждение: 7.4Beta1 "failed to create socket: Address family not supported by protocol"

Поиск
Список
Период
Сортировка

7.4Beta1 "failed to create socket: Address family not supported by protocol"

От
Robert Creager
Дата:
I'm receiving the following error during startup:

Aug 10 14:11:27 thunder postgres[18613]: [1-1] LOG:  failed to create
socket: Address family not supported by protocol

Aug 10 14:11:27 thunder postgres[18619]: [2-1] LOG:  database system was
shut down at 2003-08-10 14:11:11 MDT

Aug 10 14:11:27 thunder postgres[18619]: [3-1] LOG: checkpoint record is
at 4/E28389B4

Aug 10 14:11:27 thunder postgres[18619]: [4-1] LOG:  redo record is at
4/E28389B4; undo record is at 0/0; shutdown TRUE

Aug 10 14:11:27 thunder postgres[18619]: [5-1] LOG:  next transaction
id: 80139; next oid: 35014046

Aug 10 14:11:27 thunder postgres[18619]: [6-1] LOG:  database system is
ready

And yet everything appears to be working fine.  Something I've done
wrong in the build/configure?

tassiv=# select version();
                                                  version

-----------------------------------------------------------------------
------------------------------------ PostgreSQL 7.4beta1 on
i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2.2 (Mandrake Linux 9.1
3.2.2-3mdk)

Cheers,
Rob

--
 14:51:35 up 9 days,  7:37,  4 users,  load average: 1.13, 1.18, 1.03

Вложения

Re: 7.4Beta1 "failed to create socket: Address family not supported by protocol"

От
Tom Lane
Дата:
Robert Creager <Robert_Creager@LogicalChaos.org> writes:
> Aug 10 14:11:27 thunder postgres[18613]: [1-1] LOG:  failed to create
> socket: Address family not supported by protocol

It's normal for this to happen if you have userland (libc) code that
supports IPv6 but your kernel isn't configured to do so.  The postmaster
will try to create both IPv4 and IPv6 sockets, because getaddrinfo()
told it to, but the IPv6 attempt will fail as above.

However, I can see that this is going to become a FAQ if we leave the
behavior alone.  I am wondering if we can suppress this message without
making life difficult for people who are trying to debug actual problems
in setting up sockets.

We could just ignore EAFNOSUPPORT failures, but I'm not sure if there
are any cases where such an error would genuinely be interesting.
Another possibility is to issue the per-failure messages at a very low
level (DEBUG2 maybe) and only LOG when we can't create any socket at
all.  Perhaps there are better answers.  Any ideas?

            regards, tom lane

Re: 7.4Beta1 "failed to create socket: Address family not

От
Bruce Momjian
Дата:
My original commit had a message stating it was an IPv6 and the kernel
didn't support it.  I don't see that message in CVS anymore, but I think
we need something similar.

There was a big discussion over whether we should require IPv6 to be
enabled individually, and then throw a hard error if IPv6 fails, but at
this stage, it seemed best to most to just try IPv6 and soft-fail, while
throwing a message in the server logs.

---------------------------------------------------------------------------

Tom Lane wrote:
> Robert Creager <Robert_Creager@LogicalChaos.org> writes:
> > Aug 10 14:11:27 thunder postgres[18613]: [1-1] LOG:  failed to create
> > socket: Address family not supported by protocol
>
> It's normal for this to happen if you have userland (libc) code that
> supports IPv6 but your kernel isn't configured to do so.  The postmaster
> will try to create both IPv4 and IPv6 sockets, because getaddrinfo()
> told it to, but the IPv6 attempt will fail as above.
>
> However, I can see that this is going to become a FAQ if we leave the
> behavior alone.  I am wondering if we can suppress this message without
> making life difficult for people who are trying to debug actual problems
> in setting up sockets.
>
> We could just ignore EAFNOSUPPORT failures, but I'm not sure if there
> are any cases where such an error would genuinely be interesting.
> Another possibility is to issue the per-failure messages at a very low
> level (DEBUG2 maybe) and only LOG when we can't create any socket at
> all.  Perhaps there are better answers.  Any ideas?
>
>             regards, tom lane
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: 7.4Beta1 "failed to create socket: Address family not

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> There was a big discussion over whether we should require IPv6 to be
> enabled individually, and then throw a hard error if IPv6 fails, but at
> this stage, it seemed best to most to just try IPv6 and soft-fail, while
> throwing a message in the server logs.

The real problem is perhaps that the message gives no hint that it's
talking about being unable to establish an IPv6 socket.  With that hint,
perhaps people would realize that it's not a problem.

            regards, tom lane

Re: 7.4Beta1 "failed to create socket: Address family not

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > There was a big discussion over whether we should require IPv6 to be
> > enabled individually, and then throw a hard error if IPv6 fails, but at
> > this stage, it seemed best to most to just try IPv6 and soft-fail, while
> > throwing a message in the server logs.
>
> The real problem is perhaps that the message gives no hint that it's
> talking about being unable to establish an IPv6 socket.  With that hint,
> perhaps people would realize that it's not a problem.
>

Yes, that was my point, that in the initial message wording I had
mentioned IPv6, and the fact that it wasn't enabled in the kernel.

Not sure who took it out, but it gone.  The original message was:

  elog(LOG, "IPv6 support disabled --- perhaps the kernel does not support IPv6");

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: 7.4Beta1 "failed to create socket: Address family not

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> The real problem is perhaps that the message gives no hint that it's
>> talking about being unable to establish an IPv6 socket.  With that hint,
>> perhaps people would realize that it's not a problem.

> Not sure who took it out, but it gone.  The original message was:
>   elog(LOG, "IPv6 support disabled --- perhaps the kernel does not support IPv6");

That seems both wordy and not necessarily accurate.  What I had in mind
was more like

    "could not create IPv6 socket: %m"

But I still wonder whether we shouldn't suppress the message entirely,
at least for EAFNOSUPPORT errors.

            regards, tom lane

Re: 7.4Beta1 "failed to create socket: Address family not

От
Bruce Momjian
Дата:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> The real problem is perhaps that the message gives no hint that it's
> >> talking about being unable to establish an IPv6 socket.  With that hint,
> >> perhaps people would realize that it's not a problem.
>
> > Not sure who took it out, but it gone.  The original message was:
> >   elog(LOG, "IPv6 support disabled --- perhaps the kernel does not support IPv6");
>
> That seems both wordy and not necessarily accurate.  What I had in mind
> was more like
>
>     "could not create IPv6 socket: %m"
>
> But I still wonder whether we shouldn't suppress the message entirely,
> at least for EAFNOSUPPORT errors.

If we suppress it entirely, there is no user-visible report that IPv6
isn't enabled on this computer, though if your kernel doesn't support
it, you would think they would know that, but I suspect many people
don't know it has to be enabled in the kernel --- hence the wording of
the original message.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073