The following reply was made to PR mod_jserv/5755; it has been noted by GNATS.
From: Ed Korthof <[EMAIL PROTECTED]> To: Vladislav Malyshkin <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: Re: mod_jserv/5755: mod_jserv and httpd -HUP restarting problem Date: Tue, 15 Feb 2000 07:57:54 -0800 (PST) On Tue, 15 Feb 2000, Vladislav Malyshkin wrote: > > First, I have to ask -- do you see this error occuring when you send > > SIGHUP to only the parent process? I won't be surprised if that's the > > case, but I want to know either way. > > When I send a SIGHUP to httpd root process everything is OK. > It works as: > httpd root - SIGTERM -> wrapper watcher process -> kills JVM > > in case of killall -HUP httpd command > > originally it works as > SIGHUP -> wrapper watcher process -> dies and leaves runaway JVM > SIGHUP -> httpd root -> nothing left to clean, wrapper already dead > > With my last patch I sent to you it works like: > SIGHUP -> wrapper watcher process -> kills JVM > SIGHUP -> httpd root -> SIGTERM to wrapper watcher (if we already processing > wrapper_shutdown do nothing, > otherwise do cleanup) > > Vladislav The bug which you're describing isn't a bug in Apache JServ, it's a bug in your restart script, which uses killall. You can fix it by fixing that script. You're also welcome to send your patch to the developer's list -- it's possible that folks will agree that this is a feature worth adding. (After making some changes to it, anyway.) However, it's not a bug, so I'm going to leave it and go back to my day job -- I think it's silly to work around something as broken as using killall to restart Apache. BTW -- your diagrams are incorrect. In all cases, when the parent httpd gets SIGHUP, it sends SIGHUP to it's children. It then waits some hundreds of milliseconds; if any are still alive, it sends each another SIGHUP. It then waits a bit more than a second; if any are still alive it then sends each a SIGTERM. The behavior is different if the parent recieves a SIGTERM, however -- in that case, it skips directly to sending SIGTERMs. In the second, case, using killall, here's what I'd describe: SIGHUP -> wrapper + httpd parent wrapper starts cleaning up httpd parent sends SIGHUP to all children SIGHUP -> wrapper interrupts cleanup process This illustrates why the problem is intermittent -- sometimes the wrapper will finish sending it's signal to the JVM before it recieves the second SIGHUP, and sometimes it won't. It also illustrates why killall is the wrong tool to use: none of the children are sure to be able to clean up normally, which means that other modules may misbehave as well. You'll note that your diagram offers no way in which the shutdown could ever be succesful, but you indicated that it does work some of the time. good luck -- Ed -- See you at ApacheCon 2000 in Orlanda, Florida, March 8-10, 2000. http://www.Apachecon.com/