Steve Hay wrote:
I notice that running tests via nmake test, t/TEST or t/SMOKE leaves a httpd.pid file behind in t/logs after the server has stopped. Is this supposed to happen? I thought Apache normally deleted the httpd.pid file when it is stopped.

That's not under Apache-Test's control, it's Apache who manages this file, we aren't supposed to touch it. All we do is reading the pid from it.


I also find that if there is such a httpd.pid file in place from some previous run then t/SMOKE generates an error on my Windows machine because it tries to `cat ...` the file to get the PID to kill, and "cat" isn't available on Windows (unless Cygwin tools or similar are in the PATH), e.g.:

My bad, though if we are alredy returning if the file has failed to open, this line is redundant then, no?


return unless -f $file;

> -    my $pid = `cat $file`;
> -    chomp $pid;
> +    open my $fh, '<', $file or return;
> +    chomp(my $pid = <$fh>);
> +    close $fh or return;

and close should always succeed or die if you choose to check the return code. I can't see why would you want to silently return on failing close.

The attached patch removes the use of "cat" to read any existing httpd.pid file.

But I still have a problem with the httpd.pid file being left behind in the first place. Windows OS's are terrible for re-using the same PID's over and over again within a short space of time, so if a PID file has been left behind from an Apache that has long since stopped then we don't want the next t/SMOKE trying to kill that PID because there's a good chance that it now relates to some other process entirely!

That PID file definitely needs to be cleaned up properly when the Apache used for the tests shuts down. The kill_proc() function that I've just supplied a patch for should only be trying to kill anything on the rare occasions that an Apache actually is still running!

Understood. But there could be other Apache versions running, you don't want to kill just any Apache process. Can we take the pid and check whether it's an apache process before trying to kill it?


__________________________________________________________________
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


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to