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

[libvirt] virConnectClose question



Hello,
I did find out that in some cases virConnectClose does not close the connection at all. It only returns -1 which by the documentation means error:
Returns: 0 in case of success or -1 in case of error.
But there is no other indication of what error it is. I am almost sure that it is because some open domains or other libvirt objects. If this is the case it would be good to add notice like: "You need to free all domains,....,etc before calling virConnectClose". And is there any possibility how to force closing the connection? I know that it is a good programming manner to close all objects before closing the master object but I did run into this in php-libvrit development and it is quite painful. PHP is keeping a list of all resources (objects from libvirt) and is calling my destructors to close it. Unfortunately there are some problems with this: * when garbage collector clears my resource my destructor is not called. It is probably my mistake that I do not set it correctly somewhere but I am not able to find out where. * I can not influence the order of calls. It seems that there were some discussions and that for quite some time PHP is calling destructors in reverse order of creation. That would be good but I am not sure whether it is granted. The problem with this all is that if I for some reason fail to free some domain object the connection is not closed. But as PHP does reuse threads the connection will be open forever and connection limit for libvirtd get drained very fast. So basically my question is: should I implement some list of all objects I did create and free them before calling virConnectClose or is there any other way how to "terminate" libvirt connection for good?

Radek


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