[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2] Ensure client streams are closed when marking a client for close

On 08/15/2011 11:15 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange redhat com>

NB, previous patch was borked due to bad rebase

Every active stream results in a reference being held on the
virNetServerClientPtr object. This meant that if a client quit
with any streams active, although all I/O was stopped the
virNetServerClientPtr object would leak. This causes libvirtd
to leak any file handles associated with open streams when a
client quit

To fix this, when we call virNetServerClientClose there is a
callback invoked which lets the daemon release the streams
and thus the extra references

* daemon/remote.c: Add a hook to close all streams
* daemon/stream.c, daemon/stream.h: Add API for releasing
   all streams
* src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
   Allow registration of a hook to trigger when closing client
  daemon/remote.c              |   11 ++++++++++-
  daemon/stream.c              |   38 ++++++++++++++++++++++++++++++++------
  daemon/stream.h              |    3 +++
  src/rpc/virnetserverclient.c |   21 +++++++++++++++++++++
  src/rpc/virnetserverclient.h |    5 +++++
  5 files changed, 71 insertions(+), 7 deletions(-)

+daemonRemoveAllClientStreams(daemonClientStream *stream)
+    daemonClientStream *tmp;
+    VIR_DEBUG("stream=%p", stream);
+    while (stream) {
+        tmp = stream->next;
+        if (!stream->closed) {
+            virStreamEventRemoveCallback(stream->st);
+            virStreamAbort(stream->st);
+        }
+        daemonFreeClientStream(NULL, stream);
+        VIR_DEBUG("next stream=%p", stream);
+        stream = tmp;

Is that the right VIR_DEBUG message, or should it be:

VIR_DEBUG("next stream=%p", tmp);

ACK with that fixed.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]