From 56afd466dddb31f85d03ec3885f5e4fa2ce52e5f Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 30 Oct 2019 10:28:24 +0100 Subject: [PATCH] QMPClient: add destructor 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... Signed-off-by: Wolfgang Bumiller --- PVE/QMPClient.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/PVE/QMPClient.pm b/PVE/QMPClient.pm index 7d756635..96b6a242 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); + } +} + 1;