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

Re: [libvirt] [PATCH 08/10] qemu: Add ability to abort existing console while creating new one

On 10/18/2011 12:23 PM, Daniel P. Berrange wrote:

Hmm, I have a feeling this will cause a leak. Currently the virStreamPtr
reference is held by the daemon itself, and when the client disconnects
it free's the stream. With this extra reference held by the QEMU driver,
the virStreamPtr will live forever if a client disconnects, without
closing its stream. In fact I think it'll live forever even if the client
does an explicit finish/abort, since you only seem to release the reference
when the virDomainObjPtr is free'd, or when another console is opened.

Yes, memory is being held allocated indefinitly after the first console
connection is made. I would not describe it as a leak, as if a new console
is opened or the domain object is freed, the old reference is free'd.
So no buildup of this memory is possible after the first connection is made.
A possible solution to this (if allocating some extra bytes of memory is a
big issue), would be to internally add another callback to the fdstream,
and register a handler to it, that would free the reference to the stream
object and reset the pointer needed to detect a live session.
Otherwise I don't see any other possibility how to detect if the client
has disconnected and thus removing the stream object.


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