diff options
author | wpaul <wpaul@FreeBSD.org> | 1999-02-10 16:16:14 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1999-02-10 16:16:14 +0000 |
commit | fdde373153fe0ee29cd1819aa4d38e1b20bb3565 (patch) | |
tree | fa910f03011a54963bd70e48fc4f3a86a11038ff /usr.sbin/ypserv/yp_server.c | |
parent | 8d9b8047a3f4381cb28d8751cef0c3d36b4db86c (diff) | |
download | FreeBSD-src-fdde373153fe0ee29cd1819aa4d38e1b20bb3565.zip FreeBSD-src-fdde373153fe0ee29cd1819aa4d38e1b20bb3565.tar.gz |
Add some tweaks to hopefully fix a problem I've started to notice recently.
Under certain conditions (possibly associated with heavy load), ypserv will
fork() child processes that don't exit like they're supposed to. I think
this is because of some suspect logic in the ypproc_all procedure. I updated
it to use what I hope is a more bulletproof approach.
Also tweaked yp_svc_run() a little so that the 'are we a child?' test happens
at every pass through the for(;;) loop, not just immediately after returning
from svc_getreqset2().
Diffstat (limited to 'usr.sbin/ypserv/yp_server.c')
-rw-r--r-- | usr.sbin/ypserv/yp_server.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c index 3b645a8..76cb5ea 100644 --- a/usr.sbin/ypserv/yp_server.c +++ b/usr.sbin/ypserv/yp_server.c @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] = - "$Id: yp_server.c,v 1.1 1997/11/09 20:54:38 wpaul Exp wpaul $"; + "$Id: yp_server.c,v 1.26 1998/02/11 19:15:32 wpaul Exp $"; #endif /* not lint */ #include "yp.h" @@ -506,12 +506,22 @@ ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) * block. (Is there a better way to do this? Maybe with * async socket I/O?) */ - if (!debug && children < MAX_CHILDREN && fork()) { - children++; - forked = 0; - return (NULL); - } else { - forked++; + if (!debug) { + switch(fork()) { + case 0: + forked++; + break; + case -1: + yp_error("ypall fork(): %s", strerror(errno)); + result.ypresp_all_u.val.stat = YP_YPERR; + return(&result); + break; + default: + children++; + forked = 0; + return (NULL); + break; + } } if (yp_select_map(argp->map, argp->domain, |