Date: Thu, 4 Jun 1998 10:05:59 +0100 From: njs3@doc.ic.ac.uk (Niall Smart) To: dk+@ua.net, barry@Lustig.COM Cc: freebsd-hackers@FreeBSD.ORG, serge@yahoo.com Subject: Re: Code Logic Question in 2.2 RELENG Message-ID: <E0yhVyB-0000hZ-00@oak66.doc.ic.ac.uk> In-Reply-To: Dmitry Kohmanyuk <dk@dog.farm.org> "Re: Code Logic Question in 2.2 RELENG" (Jun 3, 11:14pm)
next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 3, 11:14pm, Dmitry Kohmanyuk wrote:
} Subject: Re: Code Logic Question in 2.2 RELENG
> 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...
Damn, I saw this bugs ages ago here and a patch was posted (by Tim Hoek
I think). How come it wasn't committed to -stable too? Yet another
example of an important and easily fixed problem for which a patch is
available only making it into -current.
The problem is that the signal handler clobbers errno.
> 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:
Please try the following patch, or wait for a couple of days until
it gets committed to -stable and cvsup.
*** /usr/src/usr.sbin/portmap/portmap.c Thu Jun 4 10:02:58 1998
--- /usr/src/usr.sbin/portmap/portmap.c Thu Jun 4 10:02:49 1998
***************
*** 85,90 ****
--- 85,91 ----
*/
#include <err.h>
+ #include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
***************
*** 604,608 ****
--- 605,613 ----
void
reap()
{
+ int save_errno;
+
+ save_errno = errno;
while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
+ errno = save_errno;
}
Niall
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?E0yhVyB-0000hZ-00>
