Full_Name: Michael Haardt Version: OPENLDAP_REL_ENG_1_2 OS: Linux URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (194.97.109.109) slapd does not appear to wait for created processes, so each request causes a zombie.
michael@roka.net writes: > slapd does not appear to wait for created processes, so each request > causes a zombie. Try this. *** servers/slapd/main.c 1999/03/09 06:15:35 1.41 --- servers/slapd/main.c 1999/03/11 21:14:35 *************** *** 8,11 **** --- 8,14 ---- #include <ac/time.h> #include <ac/unistd.h> + #include <ac/wait.h> + #include <ac/signal.h> + #include <ac/errno.h> #include "ldapconfig.h" *************** *** 13,16 **** --- 16,21 ---- #include "lutil.h" /* Get lutil_detach() */ + static RETSIGTYPE wait4child( int sig ); + /* * when more than one slapd is running on one machine, each one might have *************** *** 189,192 **** --- 194,209 ---- } + if ( ! inetd ) { + /* + * Done early in case a backend needs to set up its own + * signal handler + */ + #ifdef SIGCHLD + signal( SIGCHLD, wait4child ); + #else + signal( SIGCLD, wait4child ); + #endif + } + if ( read_config( configfile ) != 0 ) { rc = 1; *************** *** 330,333 **** --- 347,363 ---- + static RETSIGTYPE + wait4child( int sig ) + { + #if defined(HAVE_WAITPID) && defined(WNOHANG) + while ( waitpid( (pid_t)-1, NULL, WNOHANG ) >= 0 || errno == EINTR ) + ; /* NULL */ + #else + (void) wait( NULL ); + #endif + (void) signal( sig, wait4child ); + } + + #ifdef LOG_LOCAL4 -- Hallvard
changed notes moved from Incoming to Software Bugs
> michael@roka.net writes: > > slapd does not appear to wait for created processes, so each request > > causes a zombie. > > Try this. > [patch deleted] Thanks, I applied the patch and it works fine. I am surprised that the exit status is obviously not checked, but it does of course solve the zombie problem to wait for a child each time one terminates. Michael
michael@roka.net writes: > Thanks, I applied the patch and it works fine. I am surprised that the > exit status is obviously not checked, but it does of course solve the > zombie problem to wait for a child each time one terminates. Yes, back-shell could use some improvement - which means it needs someone to improve it. Feel free to contribute a fix... -- Hallvard
changed notes
changed state Open to Test
A somewhat modified patch is committed to -devel. I'd be happy if someone could tell me when to use waitpid and when to use wait3, though.
changed state Test to Release
changed state Release to Test
changed state Test to Closed
Patch needs to be applied to rel eng 1.2.