[libvirt-users] Unable to close open libvirt connections

Jatin Kumar cs5090243 at cse.iitd.ernet.in
Thu Jan 12 11:28:03 UTC 2012


Thanks, setting dom=None solved the problem. But that needs to make alot of
changes in the code. Do we have any other alternative ?

--
Jatin

On Thu, Jan 12, 2012 at 3:46 PM, Daniel P. Berrange <berrange at redhat.com>wrote:

> On Thu, Jan 12, 2012 at 10:10:47AM +0100, Michal Privoznik wrote:
> > On 11.01.2012 19:14, Jatin Kumar wrote:
> > > Hello,
> > > I was getting the following error in syslog:
> > > libvirtd: 21:19:12.116: 10955: error : qemudDispatchServer:1355 : Too
> > > many active clients (20), dropping connection from 127.0.0.1;0
> > >
> > > I investigated a bit and tried the following in a python console:
> > >
> > > import libvirt
> > > ~~~~
> > > conn=libvirt.openReadOnly("qemu+ssh://HOST_IP/system
> > > <http://10.16.71.1/system>")
> > > //now check the no. of connections (by lsof|grep ESTABLISHED in the
> > > HOST), the count will increase by 1
> > > conn.close()
> > > *//the count will decrease by 1, it returns 0*
> > > ~~~~
> > > conn=libvirt.openReadOnly("qemu+ssh://HOST_IP/system
> > > <http://10.16.71.1/system>")
> > > //now check the no. of connections, the count will increase by 1
> > > dom=conn.lookupByName("sowmya")
> > > print dom.info <http://dom.info/>()
> > > conn.close()
> > > *//the count will not change, it returns 1*
> > > *
> > > *
> > > This is creating a lot of trouble to me but the reason is unknown.
> > > If someone could please point me out, if i am missing something.
> > > --
> > > Jatin
> >
> > conn.close() returns the number of references to connection object;
> > So if the latter example returns 1 it is right as you still have domain
> > object which you obtained via lookupByName(). So you need to destroy
> > that object prior to closing connection.
>
> It is probably sufficient to just do
>
>   dom = None
>
> to force immediate garbage collection of the 'dom' object
>
> Daniel
> --
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/:|
> |: http://libvirt.org              -o-             http://virt-manager.org:|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/:|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc:|
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120112/1434f670/attachment.htm>


More information about the libvirt-users mailing list