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.bumil...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to