Jim Jagielski wrote:
Maybe... but it works fine with Linux, so it would be then how
each OS handles the whole process group stuff.

Aaron Bannert wrote:

On Sun, Apr 07, 2002 at 09:38:15AM -0400, Jim Jagielski wrote:

Haven't seen the patch yet, but for some systems it's the waitpid() call
that seems weird.

Could it have something to do with how we're creating a new process group after forking and killing the parent? I don't remember this happening before my original -DNO_DETACH changes.

In any case how would you write this as cross-platform code in C? If I have the C code I can easily port it to Perl. There are two parts the sighandler:

$SIG{CHLD} = { something that tries to catch if the child has died }

and the fork:

        my $cmd = "httpd ..."
        defined(my $pid = fork) or die "Can't fork: $!";
        unless ($pid) { # child
            my $status = system "$cmd";
            if ($status) {
                $status  = $? >> 8;
                #error "httpd didn't start! $status";
            }
            CORE::exit $status;
        }
    }

And the startup algorithm is as follows:

1. set the SIGCHLD
2. fork a new child process
3. start the process via system in the child process (exec is not good since we want to report exit status, but can be done via wait*() as well)
4. fetch /index.html to test whether the server responds (and wait till it does or timeout)
5. reset SIGCHLD to DEFAULT


So if between 3. and 5. the forked in 2. child dies, there is a problem, and we report a startup failure.

Apparently on hpux and a few others child is reported is dead, when it's not. Now please fill in the missing info, of why does this happen.

Thanks.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to