[pve-devel] [PATCH v3 1/3] migrate: collect migration tunnel child process

Dietmar Maurer dietmar at proxmox.com
Thu Jun 2 10:34:21 CEST 2016


I do not really understand this loop. 

* Why do you call kill -9 multiple times?

* Why do you iterate 20 times (instead of 30)?

> +    # collect child process
> +    for (my $i = 1; $i < 20; $i++) {
> +	my $waitpid = waitpid($cpid, WNOHANG);
> +	last if (defined($waitpid) && ($waitpid == $cpid));
> +
> +	if ($i == 10) {
> +	    $self->log('info', "ssh tunnel still running - terminating now with
> SIGTERM");
> +	    kill(15, $cpid);
> +	} elsif ($i >= 15) {
> +	    $self->log('info', "ssh tunnel still running - terminating now with
> SIGKILL");
> +	    kill(9, $cpid);
>  	}
> +	sleep (1);
>      }




More information about the pve-devel mailing list