Thread: stats collector "connection refused" on recv of test message

stats collector "connection refused" on recv of test message

From
Steve Singer
Date:
On one of my machines I get

LOG:  could not receive test message on socket for statistics collector: Connection refused

on startup.  I noticed this testing 9.0 but when I went back to check I'm 
now getting it on 8.3 as well, disabling all of my iptables rules doesn't 
help.

I've done some debugging and the recv() call for reading the test message in 
pgstat.c is returning -1 with ernno set to 111 (connection refused) as the 
log message indicates.   The previous calls on PgStatSocket all seemed to 
work fine (including the send and select).

If I modify pgstat.c so that it uses pgStatSock for the bind() and receive 
but a second socket structure for the connect() and send() everything seems 
to work fine (I modify both the send calls for both the 'test' message and 
the real stats messages).

Someone else recently reported this error on -admin here 
http://archives.postgresql.org/pgsql-admin/2010-04/msg00109.php but the 
through sort of stopped.

Is using a single UDP socket structure instance for sending a message to 
yourself 'proper'? (it looks like we've been doing this in pgstat.c for 
many years without issues reported).

This machine is a 32bit powerpc running Debian linux with kernel 2.6.22 and 
glibc 2.7-18 installed.  I'm wondering if something was changed in the linux 
kernel to break this.

Steve





Re: stats collector "connection refused" on recv of test message

From
Tom Lane
Date:
Steve Singer <ssinger_pg@sympatico.ca> writes:
> Is using a single UDP socket structure instance for sending a message to 
> yourself 'proper'? (it looks like we've been doing this in pgstat.c for 
> many years without issues reported).

Why wouldn't it be?

> This machine is a 32bit powerpc running Debian linux with kernel 2.6.22 and 
> glibc 2.7-18 installed.  I'm wondering if something was changed in the linux 
> kernel to break this.

Sounds like it.  File a debian bug.
        regards, tom lane