Bjoern A. Zeeb wrote:
> On Fri, 7 Jun 2002, Bruce Momjian wrote:
>
> Hi,
>
> it's been some months so I left the fullquote attached.
>
> > Well, you are the first to report that 127.0.0.1 doesn't work for stats.
> > Unless someone else has a problem, I think we will leave it unchanged.
>
>
> The last years this problem was disucced several times (mostly on
> FreeBSD lists) for the reason of FreeBSD jails. I thought that we
> had another mail in 2002 about that but couldn't find it anymore.
>
> Anyway binding to 127.0.0.1 in a jail binds to the (usually public) IP
> address of that jail which means the stats socket is basically open to
> world (from the socket point of view).
Yes, but we need an interface that will drop packets on heavy load, and
a local IP is the only way we know to do that.
> Another problem (which is not a postgresql problem per se) is that if
> the system is built without inet6 support or does not support inet6
> (as in jails) but there is a ::1 localhost in /etc/hosts the error
> messages gives a warning like:
> could not create socket for statistics collector:
> Protocol not supported
> which sound annoying in first places until you find out that it worked
> anyway and remember what cuases the warning.
Yes, that is confusing. The following patch adds a message after the
error:
trying another address for the statistics collector
which should help reduce confusion. It will appear in 8.2.
> Is there any reason why you explicitly disallow a posix local socket
> at that point in backend/postmaster/pgstat.c:pgstat_init:
>
> ...
> for (addr = addrs; addr; addr = addr->ai_next)
> {
> #ifdef HAVE_UNIX_SOCKETS
> /* Ignore AF_UNIX sockets, if any are returned. */
> if (addr->ai_family == AF_UNIX)
> continue;
> #endif
> ...
>
>
> Couldn't you use/allow (if possible or configured) a posix local socket
> or even use pipes for that?
Yes, because it can't drop packets, I think.
--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Index: src/backend/postmaster/pgstat.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v
retrieving revision 1.122
diff -c -c -r1.122 pgstat.c
*** src/backend/postmaster/pgstat.c 6 Apr 2006 20:38:00 -0000 1.122
--- src/backend/postmaster/pgstat.c 20 Apr 2006 10:43:16 -0000
***************
*** 216,222 ****
struct timeval tv;
char test_byte;
int sel_res;
!
#define TESTBYTEVAL ((char) 199)
/*
--- 216,223 ----
struct timeval tv;
char test_byte;
int sel_res;
! int tries = 0;
!
#define TESTBYTEVAL ((char) 199)
/*
***************
*** 276,281 ****
--- 277,286 ----
continue;
#endif
+ if (++tries > 1)
+ ereport(LOG,
+ (errmsg("trying another address for the
statistics collector")));
+
/*
* Create the socket.
*/
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match