Record High Load Average - due to SunOS 4.0 rwhod
Mark Plotnick
mp at andante.UUCP
Sat May 20 13:09:40 AEST 1989
SunOS 4.0 users may have seen things like
rubato up 12:45, 0 users, load 1242604.92, 535.62, 0.00
due to bogus information being broadcast by rwhod. A bad interaction
with Yellow Pages (isn't that a tautology?) is the culprit. It looks like
YP depends on some file descriptors being kept open across calls.
rwhod closes all descriptors between 0 and 9, and does so after the
Yellow Pages has been initialized. And it turns out that the problem
goes away when you #define DEBUG to take a closer look at the problem,
because the close() calls are bracketed by #ifndef DEBUG/#endif !
Here's my fix. I also renamed the debugging version of sendto() that
rwhod provides so that it wouldn't mistakenly be called by Yellow Pages
routines.
*** rwhod.orig.c Fri Aug 26 10:50:37 1988
--- rwhod.c Fri Aug 26 11:04:57 1988
***************
*** 105,112 ****
if (fork())
exit(0);
{ int s;
! for (s = 0; s < 10; s++)
(void) close(s);
(void) open("/", 0);
(void) dup2(0, 1);
(void) dup2(0, 2);
--- 105,115 ----
if (fork())
exit(0);
{ int s;
! for (s = getdtablesize()-10; s < getdtablesize(); s++)
(void) close(s);
+ (void) close(0);
+ (void) close(1);
+ (void) close(2);
(void) open("/", 0);
(void) dup2(0, 1);
(void) dup2(0, 2);
***************
*** 338,346 ****
mywd.wd_sendtime = htonl(time(0));
mywd.wd_vers = WHODVERSION;
mywd.wd_type = WHODTYPE_STATUS;
! for (np = neighbors; np != NULL; np = np->n_next)
(void) sendto(s, (char *)&mywd, cc, 0,
np->n_addr, np->n_addrlen);
if (utmpent && chdir(RWHODIR)) {
syslog(LOG_ERR, "chdir(%s): %m", RWHODIR);
exit(1);
--- 341,354 ----
mywd.wd_sendtime = htonl(time(0));
mywd.wd_vers = WHODVERSION;
mywd.wd_type = WHODTYPE_STATUS;
! for (np = neighbors; np != NULL; np = np->n_next) {
(void) sendto(s, (char *)&mywd, cc, 0,
np->n_addr, np->n_addrlen);
+ #ifdef DEBUG
+ (void) mysendto(s, (char *)&mywd, cc, 0,
+ np->n_addr, np->n_addrlen);
+ #endif
+ }
if (utmpent && chdir(RWHODIR)) {
syslog(LOG_ERR, "chdir(%s): %m", RWHODIR);
exit(1);
***************
*** 470,476 ****
}
#ifdef DEBUG
! sendto(s, buf, cc, flags, to, tolen)
int s;
char *buf;
int cc, flags;
--- 478,484 ----
}
#ifdef DEBUG
! mysendto(s, buf, cc, flags, to, tolen)
int s;
char *buf;
int cc, flags;
--
Mark Plotnick
andante!mp or allegra!mp
More information about the Comp.unix.wizards
mailing list