Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument

From: Kurt Roeckx <Q(at)ping(dot)be>
To: Kenji Sugita <sugita(at)sra(dot)co(dot)jp>
Cc: sugita(at)srapc1327(dot)sra(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Date: 2003-07-03 20:43:55
Message-ID: 20030703204355.GA12774@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 03, 2003 at 10:44:31AM +0900, Kenji Sugita wrote:
>
> From: Kurt Roeckx <Q(at)ping(dot)be>
> To: Kenji Sugita <sugita(at)srapc1327(dot)sra(dot)co(dot)jp>
> Cc: pgsql-hackers(at)postgresql(dot)org
> Date: Wed, 2 Jul 2003 19:20:11 +0200
>
> ;;; What system are you running on, and does it have a getaddrinfo()
> ;;; or not?
>
> Red Hat Linux 6.2 and Mac OS X 10.2.6.
[...]
> For Mac OS X it produces LOG: PGSTAT: socket() failed: Protocol not supported.

This looks a little broken behaviour to me. My guess is that it
returns an AF_INET6 socket but doesn't support it in the kernel.
In that case with the AI_ADDRCONFIG option it shouldn't have
returned that address. The question is wether your getaddrinfo()
supports that option, and wether it's working or not.

We can fix this by going over all the returned addresses until
one of the socket() calls works.

We probably should also skip AF_UNIX sockets, since that might
not be want we want.

> $ postmaster (on Red Hat)
> ...
> 2003-07-03 10:19:38 [29761] LOG: XX000: PGSTAT: getaddrinfo2() failed: Name or service not known

That is just evil. It can't even resolv localhost? Do you have
a localhost entry in /etc/hosts?

If that's not the problem I see no other way but to use
INADDR_LOOPBACK and in6addr_loopback directly instead, which I
really hate.

> What value shuld be passed to a following socket call with
> addr->ai_socktype?
>
> ==== pgstats.c ====
> if ((pgStatSock = socket(addr->ai_family,
> addr->ai_socktype, addr->ai_protocol)) < 0)
> {
> elog(LOG, "PGSTAT: socket() failed: %m");
> goto startup_failed;
> }

The ai_family should be either AF_INET or AF_INET6, ai_socktype
should be SOCK_DGRAM, and ai_protocol 0 or IPPROTO_UDP.

Kurt

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2003-07-03 20:53:22 Re: [pgadmin-support] [GENERAL] pgAdmin III - Call for Translators
Previous Message elein 2003-07-03 19:56:43 Re: Are we backwards on the sign of timezones?