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

From: Kurt Roeckx <Q(at)ping(dot)be>
To: qhwt(at)myrealbox(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org, Kenji Sugita <sugita(at)sra(dot)co(dot)jp>
Subject: Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Date: 2003-07-06 16:30:04
Message-ID: 20030706163004.GA25464@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 07, 2003 at 12:38:57AM +0900, qhwt(at)myrealbox(dot)com wrote:
>
> On Wed, Jul 02, 2003 at 03:49:19PM +0900, Kenji Sugita wrote:
> > It seems that a value of addr->ai_socktype returned by getaddrinfo in
> > pg_stat.c is not SOCK_DGRAM.
>
> Please try the following untested patch:
[...]

> + for (; addr != NULL; addr = addr->ai_next)
> + if ((pgStatSock = socket(addr->ai_family,
> + addr->ai_socktype, addr->ai_protocol)) >= 0)
> + break;

This will break. You should use a pointer to the addr, and go
over the list using that.

freeaddrinfo() needs to have the original addr back.

He seems to have 2 problems:
- On Mac OS X getaddrinfo() returns something it shouldn't.
A patch like that could fix it.
- On Linux Redhat 6.2 (and 6.0) getaddrinfo() seems to have a
problem with AI_ADDRCONFIG. Which is also used in
StreamServerPort(). So he won't be able to listen to any
socket there either.

Not being able to use AI_ADDRCONFIG is rather annoying, but I
guess if we just try all the returned addresses until 1 works
will have to do.

Try the attached patch instead.

Kurt

Attachment Content-Type Size
pgstat.diff text/plain 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kurt Roeckx 2003-07-06 16:35:52 Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Previous Message Francisco Figueiredo Jr. 2003-07-06 15:56:13 Re: Receiving data in binary format how is it encoded?