You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@lerdorf.on.ca> on 1998/04/18 17:54:58 UTC

Defaulting SIGCHLD in the children?

I have the following bug report that has been sitting in my bug database
for PHP3 for a while now:

    I'm using the apache module version with apache 1.2.4. 
    I have some scripts which call external programs, mostly
    with System. When I start apache, the return value is
    returned correctly for a while. After some time it is not,
    -1 is returned. It might be a libc problem (I use glibc 
    2.0.6, I am going to try with 2.0.7pre1 now), but I don't
    think it is probable.

A workaround which seems to fix this problem is to call 
signal(SIGCHLD,SIG_DFL) in the PHP3 module.

I am a bit confused about SIGCHLD handling in general.  Can I safely
default this signal in an Apache module?  Should Apache do this
automatically in child processes?

-Rasmus


Re: Defaulting SIGCHLD in the children?

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
> There are similar sounding bugs in the apache bugdb.  My suspicion is
> something involving popen().  Do you use popen() for anything?

You are probably right.  All my exec/system functions in PHP are
implemented using popen() behind the scenes.

-Rasmus


Re: Defaulting SIGCHLD in the children?

Posted by Dean Gaudet <dg...@arctic.org>.
I don't know why apache doesn't default SIGCHLD all the time.

As far as this particular users' bug, it sounds like a glibc problem.  And
my reasoning for this is the following from the glibc documentation:

 - Macro: int SIGCHLD
     This signal is sent to a parent process whenever one of its child
     processes terminates or stops.

     The default action for this signal is to ignore it.  If you
     establish a handler for this signal while there are child
     processes that have terminated but not reported their status via
     `wait' or `waitpid' (*note Process Completion::.), whether your
     new handler applies to those processes or not depends on the
     particular operating system.

There are similar sounding bugs in the apache bugdb.  My suspicion is
something involving popen().  Do you use popen() for anything?

Dean

On Sat, 18 Apr 1998, Rasmus Lerdorf wrote:

> 
> I have the following bug report that has been sitting in my bug database
> for PHP3 for a while now:
> 
>     I'm using the apache module version with apache 1.2.4. 
>     I have some scripts which call external programs, mostly
>     with System. When I start apache, the return value is
>     returned correctly for a while. After some time it is not,
>     -1 is returned. It might be a libc problem (I use glibc 
>     2.0.6, I am going to try with 2.0.7pre1 now), but I don't
>     think it is probable.
> 
> A workaround which seems to fix this problem is to call 
> signal(SIGCHLD,SIG_DFL) in the PHP3 module.
> 
> I am a bit confused about SIGCHLD handling in general.  Can I safely
> default this signal in an Apache module?  Should Apache do this
> automatically in child processes?
> 
> -Rasmus
> 
>