Discussion:
cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm
Stas Bekman
2002-04-07 04:09:55 UTC
Permalink
dougm 02/04/06 18:14:40
Modified: perl-framework/Apache-Test/lib/Apache TestServer.pm
this $SIG{CHLD} / $? status checking stuff does not work well on
waiting for server to start: 00:02
server has died with status 255 (please examine t/logs/error_log)
Terminated
and yet the server has started just fine, can run t/TEST -run and all
tests pass.
disabling this until somebody can make the code work properly on all
platforms.
That somebody doesn't have access to hpux/solaris to debug the problem.
Anybody to help me here.

Now that you've disable the SIGCHLD if something goes wrong, user will
have to wait for 60 secs before will be dropped to the shell.
Hmm, how about this approach:

change SIGCHLD to ping the server before checking the status? May not
work properly on slower machines.

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:***@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Doug MacEachern
2002-04-07 04:35:22 UTC
Permalink
it is a nice feature when it works, so i've re-enabled for linux only.
for the other platforms in the current state, its better to wait 60
seconds if the server fails to start than to throw and error and die when
it has successfully started.
Stas Bekman
2002-04-07 04:47:41 UTC
Permalink
Post by Doug MacEachern
it is a nice feature when it works, so i've re-enabled for linux only.
for the other platforms in the current state, its better to wait 60
seconds if the server fails to start than to throw and error and die when
it has successfully started.
that's a nice alternative :)
Hopefully those with access to platforms where it doesn't work, figure
out what's the problem.

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:***@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Jim Jagielski
2002-04-07 13:38:15 UTC
Permalink
Haven't seen the patch yet, but for some systems it's the waitpid() call
that seems weird.
Post by Doug MacEachern
it is a nice feature when it works, so i've re-enabled for linux only.
for the other platforms in the current state, its better to wait 60
seconds if the server fails to start than to throw and error and die when
it has successfully started.
--
===========================================================================
Jim Jagielski [|] ***@jaguNET.com [|] http://www.jaguNET.com/
"A society that will trade a little liberty for a little order
will lose both and deserve neither" - T.Jefferson
Aaron Bannert
2002-04-07 17:44:57 UTC
Permalink
Post by Jim Jagielski
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.

-aaron
Jim Jagielski
2002-04-07 17:52:37 UTC
Permalink
Maybe... but it works fine with Linux, so it would be then how
each OS handles the whole process group stuff.
Post by Aaron Bannert
Post by Jim Jagielski
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.
-aaron
--
===========================================================================
Jim Jagielski [|] ***@jaguNET.com [|] http://www.jaguNET.com/
"A society that will trade a little liberty for a little order
will lose both and deserve neither" - T.Jefferson
Stas Bekman
2002-04-07 18:11:45 UTC
Permalink
Post by Jim Jagielski
Maybe... but it works fine with Linux, so it would be then how
each OS handles the whole process group stuff.
Post by Aaron Bannert
Post by Jim Jagielski
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:***@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Jim Jagielski
2002-04-07 13:40:14 UTC
Permalink
Also Darwin...
Post by Stas Bekman
dougm 02/04/06 18:14:40
Modified: perl-framework/Apache-Test/lib/Apache TestServer.pm
this $SIG{CHLD} / $? status checking stuff does not work well on
That somebody doesn't have access to hpux/solaris to debug the problem.
Anybody to help me here.
--
===========================================================================
Jim Jagielski [|] ***@jaguNET.com [|] http://www.jaguNET.com/
"A society that will trade a little liberty for a little order
will lose both and deserve neither" - T.Jefferson
Jim Jagielski
2004-11-14 20:22:48 UTC
Permalink
Let's not forget the 1.3 docs, unless we can somehow combine
the 2. When you checkout/export apache-1.3, a subset of
htdocs in httpd-docs-1.3 comes along for the ride
--
===========================================================================
Jim Jagielski [|] ***@jaguNET.com [|] http://www.jaguNET.com/
"There 10 types of people: those who read binary and everyone else."
Jim Jagielski
2005-08-19 17:49:25 UTC
Permalink
***@apache.org wrote:
Thanks for the cleanups! I just wanted to get something functional
in there.
--
===========================================================================
Jim Jagielski [|] ***@jaguNET.com [|] http://www.jaguNET.com/
"Sith happens" - Yoda
Loading...