httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject Re: [PATCH] fix for server hanging on HUP
Date Wed, 12 Feb 1997 00:38:33 GMT
On Tue, 11 Feb 1997, Paul Sutton wrote:

> On Mon, 10 Feb 1997, Marc Slemko wrote:
> > Ok, today we learnt about loops.  My revised patch is below.  It
> > works for me on a server running 1.1 (and appears to fix the problem),
> > and appears to work fine in 1.2 as well.  Testers appreciated, both
> > for those who have been having problems and those who haven't.
> 
> Under current 1.2b7, I can get it to die easily with the following line. 
> This happens after about 10 to 20 iterations.
> 
>    while : ; do kill -TERM `cat /usr/www/logs/httpd.pid`; done

You don't mean TERM do you?  I sure hope you could get it to die with the
above line... <g>

> 
> This patch does fix this problem. But I think there is a an infinite loop
> if the pid refuses to die. The continue (marked <==== below) means tries
> never exceeds 4, so the while() is always true.  It is easy to fix, but I
> think a modification along the line of Dean's is a good idea (i.e. don't
> sleep for every pid which doesn't die quick enough).

Duh again; in practice, if you do have a child you can't kill you will
likely have it fail to bind to the port on restart, but...

Yes, I am planning on modifying it to work like Dean suggested.  If it
makes much if a difference, then right now the server must be so messed up
that it isn't even funny, but... doesn't hurt to speed things up a little. 



> 
> > ! 	    while (waitret == 0 && tries <= 4) {
> > ! 		waitret = waitpid(pid, &status, WNOHANG);
> > ! 		if (waitret == 0) {	/* no status to report; hasn't exited */
> > ! 		    switch (tries) {
>      .....
> > ! 		    case 4:
> > ! 			/* gave it our best shot, but alas...  If this really 
> > ! 			 * is a child we are trying to kill and it really hasn't
> > ! 			 * exited, we will likely fail to bind to the port
> > ! 			 * after the restart.
> > ! 			 */
> > ! 			log_printf(server_conf, "could not make child process %d exit, attempting to
continue anyway", pid);
> > ! 			continue;  /* <===== */
> > ! 			break;
> > ! 		    }
> > ! 		    tries++;
> > ! 		    sleep(3);
> > ! 		}
> > ! 	    }
> 
> //pcs
> 
> 
> 


Mime
View raw message