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

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Oct 30 10:28:24 CET 2019


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 <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);
+    }
+}
+
 1;
-- 
2.20.1





More information about the pve-devel mailing list