[pve-devel] applied: [PATCH qemu-server] QMPClient: add destructor

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 30 10:40:44 CET 2019


On 10/30/19 10:28 AM, Wolfgang Bumiller wrote:
> Explicitly close leftover connections in the destructor,
> otherwise the IO::Multiplex instance can be leaked causing
> the qmp connection to never be closed.
> 
> This could occur for instance when cancelling vzdump with
> ctrl+c with extremely unlucky timing...
> 

applied, but..

> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
>  PVE/QMPClient.pm | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/PVE/QMPClient.pm b/PVE/QMPClient.pm
> index 7d75663..96b6a24 100644
> --- a/PVE/QMPClient.pm
> +++ b/PVE/QMPClient.pm
> @@ -509,4 +509,13 @@ sub mux_eof {
>      }
>  }
>  
> +sub DESTROY {
> +    my ($self) = @_;
> +
> +    foreach my $sname (keys %{$self->{queue_info}}) {
> +	my $queue_info = $self->{queue_info}->{$sname};
> +	$close_connection->($self, $queue_info);
> +    }

for my $queue_info (values %{$self->{queue_info}}) {
    $close_connection->($self, $queue_info);
}
should have done the trick too ;) or 
$close_connection->($self, $_) for values %{$self->{queue_info}};
but maybe your perl is just a little bit rust-y ;-P




More information about the pve-devel mailing list