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().
This commit is contained in:
parent
c69d22506e
commit
eb822b5612
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43847
@ -32,7 +32,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: yp_main.c,v 1.17 1998/02/11 19:15:32 wpaul Exp $";
|
||||
"$Id: yp_main.c,v 1.18 1998/06/04 15:11:14 wpaul Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -143,9 +143,9 @@ yp_svc_run()
|
||||
FD_CLR(resfd, &readfds);
|
||||
}
|
||||
svc_getreqset(&readfds);
|
||||
if (forked && pid != getpid())
|
||||
exit(0);
|
||||
}
|
||||
if (forked && pid != getpid())
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user