Date: Wed, 3 Jun 1998 23:14:29 -0700 (PDT) From: Dmitry Kohmanyuk <dk@dog.farm.org> To: barry@lustig.com Cc: freebsd-hackers@FreeBSD.ORG, serge@yahoo.com Subject: Re: Code Logic Question in 2.2 RELENG Message-ID: <199806040614.XAA11387@dog.farm.org>
next in thread | raw e-mail | index | archive | help
In article <19980603171959.17140.qmail@devious.lustig.com> you wrote:
> Does it make sense to have portmap fail when svc_run returns or would it
> make more sense to try and recover and restart the loop? I've had portmap
> abort a few times now, and the only easy remedy is a reboot of the machine.
> If I try and restart portmap, I have to find all of the programs that
> registered with it and restart them. Any suggestions? By the way, this is
> from RELENG_2_2 cvsupped yesterday.
> This is from portmap.c:
> /* additional initializations */
> check_startup();
> (void)signal(SIGCHLD, reap);
> svc_run();
> syslog(LOG_ERR, "svc_run returned unexpectedly");
> abort();
this bites me from time to time... see end of this message for workaround...
> This is from svc_run.c in libc:
> void
> svc_run()
> {
> #ifdef FD_SETSIZE
> fd_set readfds;
> #else
> int readfds;
> #endif /* def FD_SETSIZE */
> for (;;) {
> #ifdef FD_SETSIZE
> readfds = svc_fdset;
> #else
> readfds = svc_fds;
> #endif /* def FD_SETSIZE */
> switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
> (struct timeval *)0)) {
> case -1:
> if (errno == EINTR) {
> continue;
> }
> perror("svc_run: - select failed");
> return;
> case 0:
> continue;
> default:
> svc_getreqset(&readfds);
> }
> }
> }
what bothers me here is how come that select() returns -1 and yet
errno != EINTR. According to man page, it should be then one of
EBADF or EINVAL, none of which can occur...
here is a promised workaround, running on production NIS server,
run from crontab every few minutes. With it, FreeBSD proves
itself as a very stable operating system:
; cat rpc.restart
#!/bin/sh
#
# RPC services restart script
# If there is a global system configuration file, suck it in.
if [ -f /etc/sysconfig ]; then
. /etc/sysconfig
fi
rpcinfo -p >/dev/null && exit 0
echo -n restarting RPC daemons:
# Portmapper should always be run, to provide RPC services for inetd.
if [ -x /usr/sbin/portmap ]; then
killall -9 portmap
sleep 1 # looks like it helps
echo -n ' portmap'; portmap
fi
# Start ypserv if we're an NIS server.
# Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
if [ "X${nis_serverflags}" != X"NO" ]; then
killall -9 ypserv
sleep 1 # looks like it helps
echo -n ' ypserv'; ypserv ${nis_serverflags}
killall -9 rpc.ypxfrd
sleep 1 # looks like it helps
if [ "X${ypxfrdflags}" != X"NO" ]; then
echo -n ' rpc.ypxfrd'; rpc.ypxfrd ${ypxfrdflags}
fi
killall -9 rpc.yppasswdd
sleep 1 # looks like it helps
if [ "X${yppasswddflags}" != X"NO" ]; then
echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${yppasswddflags}
fi
fi
# Start ypbind if we're an NIS client
if [ "X${nis_clientflags}" != X"NO" ]; then
killall -9 ypbind
sleep 1 # looks like it helps
echo -n ' ypbind'; ypbind ${nis_clientflags}
if [ "X${nis_ypsetflags}" != X"NO" ]; then
echo -n ' ypset'; ypset ${nis_ypsetflags}
fi
fi
echo ""
exit 1 # make it mail about this
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806040614.XAA11387>
