You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stanley Gambarin <ga...@OpenMarket.com> on 1997/02/28 23:44:39 UTC
Restart problems
Greeting, Apache developers.
I currently maintain the mod_fastcgi (http://www.fastcgi.com) module
for the Apache web server and we have been experiencing certain problems.
Allow me to extrapolate on the cause of the problem:
- in our init() function, we spawn off another process which performs
certain computation, including starting other processes using fork()/exec()
mechanism. When the clear_pool() function is invoked upon restart of the
server, it calls the free_proc_chain() function. The latter function sends
a SIGTERM signal to our main process, sleeps for 3 seconds and then sends
SIGKILL signal. Even though the main process catches SIGTERM, sometimes
it does not have time to kill all fork()ed/exec()ed applications, which
results in the parentless apps being run on the machine, just wasting
resources.
- my suggestion is to introduce another kill_condition, which would
make free_proc_chain function just issue a SIGTERM, without issuing SIGKILL
later. I think the above might also be related to the 3 second delay in the
execution of the certain CGI programs.
The diffs are attached below:
*** alloc.h Fri Feb 28 17:41:14 1997
--- alloc.h.old Fri Feb 28 17:40:41 1997
***************
*** 227,234 ****
* to call in the child, and an argument to be passed to the function.
*/
! enum kill_conditions { kill_never, kill_always, kill_after_timeout,
just_wait,
! kill_only_once };
int spawn_child_err (pool *, void (*)(void *), void *,
enum kill_conditions, FILE **pipe_in, FILE **pipe_out,
--- 227,233 ----
* to call in the child, and an argument to be passed to the function.
*/
! enum kill_conditions { kill_never, kill_always, kill_after_timeout,
just_wait};
int spawn_child_err (pool *, void (*)(void *), void *,
enum kill_conditions, FILE **pipe_in, FILE **pipe_out,
*** alloc.c Fri Feb 28 17:42:27 1997
--- alloc.c.old Fri Feb 28 17:40:36 1997
***************
*** 1021,1028 ****
#endif
for (p = procs; p; p = p->next) {
! if ((p->kill_how == kill_after_timeout) ||
! (p->kill_how == kill_only_once)) {
/* Subprocess may be dead already. Only need the timeout if not. */
if (kill (p->pid, SIGTERM) != -1)
need_timeout = 1;
--- 1021,1027 ----
#endif
for (p = procs; p; p = p->next) {
! if (p->kill_how == kill_after_timeout) {
/* Subprocess may be dead already. Only need the timeout if not. */
if (kill (p->pid, SIGTERM) != -1)
need_timeout = 1;
Thanks, Stanley.
Re: Restart problems
Posted by Dean Gaudet <dg...@arctic.org>.
An old one. +1 on this going into HEAD.
Dean
On Fri, 28 Feb 1997, Stanley Gambarin wrote:
> Greeting, Apache developers.
>
> I currently maintain the mod_fastcgi (http://www.fastcgi.com) module
> for the Apache web server and we have been experiencing certain problems.
> Allow me to extrapolate on the cause of the problem:
> - in our init() function, we spawn off another process which performs
> certain computation, including starting other processes using fork()/exec()
> mechanism. When the clear_pool() function is invoked upon restart of the
> server, it calls the free_proc_chain() function. The latter function sends
> a SIGTERM signal to our main process, sleeps for 3 seconds and then sends
> SIGKILL signal. Even though the main process catches SIGTERM, sometimes
> it does not have time to kill all fork()ed/exec()ed applications, which
> results in the parentless apps being run on the machine, just wasting
> resources.
> - my suggestion is to introduce another kill_condition, which would
> make free_proc_chain function just issue a SIGTERM, without issuing SIGKILL
> later. I think the above might also be related to the 3 second delay in the
> execution of the certain CGI programs.
>
> The diffs are attached below:
> *** alloc.h Fri Feb 28 17:41:14 1997
> --- alloc.h.old Fri Feb 28 17:40:41 1997
> ***************
> *** 227,234 ****
> * to call in the child, and an argument to be passed to the function.
> */
>
> ! enum kill_conditions { kill_never, kill_always, kill_after_timeout,
> just_wait,
> ! kill_only_once };
>
> int spawn_child_err (pool *, void (*)(void *), void *,
> enum kill_conditions, FILE **pipe_in, FILE **pipe_out,
> --- 227,233 ----
> * to call in the child, and an argument to be passed to the function.
> */
>
> ! enum kill_conditions { kill_never, kill_always, kill_after_timeout,
> just_wait};
>
> int spawn_child_err (pool *, void (*)(void *), void *,
> enum kill_conditions, FILE **pipe_in, FILE **pipe_out,
>
> *** alloc.c Fri Feb 28 17:42:27 1997
> --- alloc.c.old Fri Feb 28 17:40:36 1997
> ***************
> *** 1021,1028 ****
> #endif
>
> for (p = procs; p; p = p->next) {
> ! if ((p->kill_how == kill_after_timeout) ||
> ! (p->kill_how == kill_only_once)) {
> /* Subprocess may be dead already. Only need the timeout if not. */
> if (kill (p->pid, SIGTERM) != -1)
> need_timeout = 1;
> --- 1021,1027 ----
> #endif
>
> for (p = procs; p; p = p->next) {
> ! if (p->kill_how == kill_after_timeout) {
> /* Subprocess may be dead already. Only need the timeout if not. */
> if (kill (p->pid, SIGTERM) != -1)
> need_timeout = 1;
>
> Thanks, Stanley.
>
>
>