cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftp testserver hung

From: Guenter Knauf <eflash_at_gmx.net>
Date: Tue, 26 Jun 2007 19:44:18 +0200

Hi Daniel,
thanks for your comments!

> Correct, there's a lot of code that doesn't care about removing the pid
> file after killing the pid so just relying on the existance of a pid file is
> not a good enough check to check for "trailing" servers. I would suggest
> you try doing a kill 0 on the pid to check if they still exist.
done.

> Oh, and do kill -9 (SIGKILL) to be really sure that you terminate the
> process.
done.

new patch:

--- testcurl.pl.orig 2007-04-01 15:59:50.000000000 +0200
+++ testcurl.pl 2007-06-26 17:49:11.000000000 +0200
@@ -200,6 +200,24 @@
 sub mydie($){
     my $text=$_[0];
     logit "$text";
+ # check if we have test servers hanging around...
+ while (<tests/.*.pid>) {
+ if (open(I, $_)) {
+ my $pid = <I>;
+ chomp($pid);
+ close(I) or logit "couldn't close $_: $!";
+ if (kill 0, $pid) {
+ logit "trying to kill $_ process ($pid)";
+ if (kill 9, $pid) {
+ logit "successfully killed $_ process ($pid)";
+ } else {
+ logit "failed to kill $_ process ($pid)";
+ }
+ }
+ } else {
+ logit "couldn't open $_: $!";
+ }
+ }
     chdir $pwd; # cd back to the original root dir
 
     if ($pwd && $build) {

first testrun looks better now.....

Guen.
Received on 2007-06-26