You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dave Hill <Da...@Compaq.com> on 2002/04/17 16:18:45 UTC

Problem with child reaping on Tru64

Hi all,
        I have run into a problem on Compaq Tru64 with cgi processes
being reaped when using with mpm worker.

        I had always thought the signal(SIGCHLD,SIG_IGN) would always
cause child processes to quietly go away but....

        After rooting around through the libc and kernel code I found
that many behaviors related to SIGCHLD and SIG_IGN are supported, but
which one is used depends on which compile flags are set (which trigger
different standards behavior, sysV or XPG4 for example).  The default
behavior for SIGCHLD & SIG_IGN is *not* for the child to disappear.
The Tru64 prefered way to get the desired behavior is to use sigaction
and add the flag SA_NOCLDWAIT. Rather than play with compile flags
(like -DOPEN_SOURCE) and as apr is using sigaction anyway... I think a
small change to signal.c may be the least intrusive fix.

SA_NOCLDWAIT is supposed to be a XPG4/XSH4.2 standards thingie...

Lastly - this only affects mod_cgid.c in the current code base.

Dave Hill

*** srclib/apr/threadproc/unix/signals.c.orig   Tue Apr 16 18:22:07 2002

--- srclib/apr/threadproc/unix/signals.c        Wed Apr 17 10:03:48 2002

***************
*** 105,110 ****
--- 105,116 ----
  #ifdef SA_INTERRUPT             /* SunOS */
      act.sa_flags |= SA_INTERRUPT;
  #endif
+ #ifdef SA_NOCLDWAIT
+     /* this is required on Tru64 to cause child processes to
+        disapear gracefully - XPG4 compatible */
+     if((signo == SIGCHLD) && (func == SIG_IGN))
+       act.sa_flags |= SA_NOCLDWAIT;
+ #endif
      if (sigaction(signo, &act, &oact) < 0)
          return SIG_ERR;
      return oact.sa_handler;



--
+---------------------oOO--(_)--OOo------------------------+
|Dave Hill                (0 0)    Unix Software Group     |
|Mailstop: ZKO3-2/W17     \//\/                            |
|Digital Equipment Corp.           (603 )884-2985          |
|110 Spitbrook Road       /\//\    enet: ddhill@zk3.dec.com|
|Nashua, NH 03062-2698    (0_0)                            |
+---------------------oOO--(_)--OOo------------------------+




Re: Problem with child reaping on Tru64

Posted by Jeff Trawick <tr...@attglobal.net>.
Dave Hill <Da...@Compaq.com> writes:

> Hi all,
>         I have run into a problem on Compaq Tru64 with cgi processes
> being reaped when using with mpm worker.

committed to APR... for now it is enabled only on Tru64... (not the
right thing to do :) )

Thanks!

> ***************
> *** 105,110 ****
> --- 105,116 ----
>   #ifdef SA_INTERRUPT             /* SunOS */
>       act.sa_flags |= SA_INTERRUPT;
>   #endif
> + #ifdef SA_NOCLDWAIT
> +     /* this is required on Tru64 to cause child processes to
> +        disapear gracefully - XPG4 compatible */
> +     if((signo == SIGCHLD) && (func == SIG_IGN))
> +       act.sa_flags |= SA_NOCLDWAIT;
> + #endif
>       if (sigaction(signo, &act, &oact) < 0)
>           return SIG_ERR;
>       return oact.sa_handler;

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: Problem with child reaping on Tru64

Posted by Jeff Trawick <tr...@attglobal.net>.
Dave Hill <Da...@Compaq.com> writes:

> Hi all,
>         I have run into a problem on Compaq Tru64 with cgi processes
> being reaped when using with mpm worker.
> 
>         I had always thought the signal(SIGCHLD,SIG_IGN) would always
> cause child processes to quietly go away but....

This patch looks reasonable to me.  Any comments from others?

We may need to eventually add support for systems with no
SA_NOCLDWAIT.  Some such systems may leave zombies when SIGCHLD is
SIG_IGN-ored.

For that case we'd need to set a handler to reap (and ignore) the
status.

> *** srclib/apr/threadproc/unix/signals.c.orig   Tue Apr 16 18:22:07 2002
> 
> --- srclib/apr/threadproc/unix/signals.c        Wed Apr 17 10:03:48 2002
> 
> ***************
> *** 105,110 ****
> --- 105,116 ----
>   #ifdef SA_INTERRUPT             /* SunOS */
>       act.sa_flags |= SA_INTERRUPT;
>   #endif
> + #ifdef SA_NOCLDWAIT
> +     /* this is required on Tru64 to cause child processes to
> +        disapear gracefully - XPG4 compatible */
> +     if((signo == SIGCHLD) && (func == SIG_IGN))
> +       act.sa_flags |= SA_NOCLDWAIT;
> + #endif
>       if (sigaction(signo, &act, &oact) < 0)
>           return SIG_ERR;
>       return oact.sa_handler;

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: Problem with child reaping on Tru64

Posted by Jeff Trawick <tr...@attglobal.net>.
Dave Hill <Da...@Compaq.com> writes:

> Hi all,
>         I have run into a problem on Compaq Tru64 with cgi processes
> being reaped when using with mpm worker.

committed to APR... for now it is enabled only on Tru64... (not the
right thing to do :) )

Thanks!

> ***************
> *** 105,110 ****
> --- 105,116 ----
>   #ifdef SA_INTERRUPT             /* SunOS */
>       act.sa_flags |= SA_INTERRUPT;
>   #endif
> + #ifdef SA_NOCLDWAIT
> +     /* this is required on Tru64 to cause child processes to
> +        disapear gracefully - XPG4 compatible */
> +     if((signo == SIGCHLD) && (func == SIG_IGN))
> +       act.sa_flags |= SA_NOCLDWAIT;
> + #endif
>       if (sigaction(signo, &act, &oact) < 0)
>           return SIG_ERR;
>       return oact.sa_handler;

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: Problem with child reaping on Tru64

Posted by Jeff Trawick <tr...@attglobal.net>.
Dave Hill <Da...@Compaq.com> writes:

> Hi all,
>         I have run into a problem on Compaq Tru64 with cgi processes
> being reaped when using with mpm worker.
> 
>         I had always thought the signal(SIGCHLD,SIG_IGN) would always
> cause child processes to quietly go away but....

This patch looks reasonable to me.  Any comments from others?

We may need to eventually add support for systems with no
SA_NOCLDWAIT.  Some such systems may leave zombies when SIGCHLD is
SIG_IGN-ored.

For that case we'd need to set a handler to reap (and ignore) the
status.

> *** srclib/apr/threadproc/unix/signals.c.orig   Tue Apr 16 18:22:07 2002
> 
> --- srclib/apr/threadproc/unix/signals.c        Wed Apr 17 10:03:48 2002
> 
> ***************
> *** 105,110 ****
> --- 105,116 ----
>   #ifdef SA_INTERRUPT             /* SunOS */
>       act.sa_flags |= SA_INTERRUPT;
>   #endif
> + #ifdef SA_NOCLDWAIT
> +     /* this is required on Tru64 to cause child processes to
> +        disapear gracefully - XPG4 compatible */
> +     if((signo == SIGCHLD) && (func == SIG_IGN))
> +       act.sa_flags |= SA_NOCLDWAIT;
> + #endif
>       if (sigaction(signo, &act, &oact) < 0)
>           return SIG_ERR;
>       return oact.sa_handler;

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...