[Libvir] PATCH: Force close of virConnectPtr if client quits abnormally

If a remote client quits abnormally (or if the server forcably drops a client for misbehaviing), it is possible that the virConnectPtr object is not closed. This leads to a build up of active connections in the server. The attached patch simply calls virConnectClose when killing off a client connection if there is a non-NULL client->conn object. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Thu, Jul 12, 2007 at 12:39:48AM +0100, Daniel P. Berrange wrote:
If a remote client quits abnormally (or if the server forcably drops a client for misbehaviing), it is possible that the virConnectPtr object is not closed. This leads to a build up of active connections in the server. The attached patch simply calls virConnectClose when killing off a client connection if there is a non-NULL client->conn object.
Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
diff -u -p -r1.52 qemud.c --- qemud/qemud.c 26 Jun 2007 23:48:47 -0000 1.52 +++ qemud/qemud.c 11 Jul 2007 23:37:10 -0000 @@ -1023,6 +1036,9 @@ static void qemudDispatchClientFailure(s
virEventRemoveHandleImpl(client->fd);
+ if (client->conn) + virConnectClose(client->conn); + if (client->tls && client->session) gnutls_deinit (client->session); close(client->fd); free(client);
makes sense +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel P. Berrange wrote:
If a remote client quits abnormally (or if the server forcably drops a client for misbehaviing), it is possible that the virConnectPtr object is not closed. This leads to a build up of active connections in the server. The attached patch simply calls virConnectClose when killing off a client connection if there is a non-NULL client->conn object.
Dan.
------------------------------------------------------------------------
diff -u -p -r1.52 qemud.c --- qemud/qemud.c 26 Jun 2007 23:48:47 -0000 1.52 +++ qemud/qemud.c 11 Jul 2007 23:37:10 -0000 @@ -1023,6 +1036,9 @@ static void qemudDispatchClientFailure(s
virEventRemoveHandleImpl(client->fd);
+ if (client->conn) + virConnectClose(client->conn); + if (client->tls && client->session) gnutls_deinit (client->session); close(client->fd); free(client);
Yup. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Richard W.M. Jones