Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm

2002-04-07 Thread 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.




Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache

2002-04-07 Thread Jim Jagielski
Haven't seen the patch yet, but for some systems it's the waitpid() call
that seems weird.

Doug MacEachern wrote:
 
 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   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
  A society that will trade a little liberty for a little order
 will lose both and deserve neither - T.Jefferson


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache

2002-04-07 Thread Jim Jagielski
Also Darwin... 

Stas Bekman wrote:
 
 [EMAIL PROTECTED] wrote:
  dougm   02/04/06 18:14:40
  
Modified:perl-framework/Apache-Test/lib/Apache TestServer.pm
Log:
this $SIG{CHLD} / $? status checking stuff does not work well on
solaris or hpux.  more often than not get:

 That somebody doesn't have access to hpux/solaris to debug the problem. 
 Anybody to help me here.
 


-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
  A society that will trade a little liberty for a little order
 will lose both and deserve neither - T.Jefferson


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache

2002-04-07 Thread Aaron Bannert
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.

-aaron


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache

2002-04-07 Thread Jim Jagielski
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.
 
 -aaron
 


-- 
===
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
  A society that will trade a little liberty for a little order
 will lose both and deserve neither - T.Jefferson


Re: cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache

2002-04-07 Thread Stas Bekman
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 BekmanJAm_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