Bug 1113938
| Summary: | error : virNetServerAddClient:270 | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Petr Sklenar <psklenar> |
| Component: | virt-who | Assignee: | Radek Novacek <rnovacek> |
| Status: | CLOSED ERRATA | QA Contact: | gaoshang <sgao> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.7 | CC: | jdenemar, ovasik, rbalakri, rnovacek, shihliu, tlavigne |
| Target Milestone: | rc | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | virt-who-0.10-3.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-10-14 07:13:18 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Petr Sklenar
2014-06-27 09:40:10 UTC
This is a bug in virt-who:
In /usr/share/virt-who/virt/libvirtd/libvirtd.py:
class Libvirtd(virt.DirectVirt):
...
def _connect(self):
monitor = LibvirtMonitor()
try:
self.virt = libvirt.openReadOnly('')
except libvirt.libvirtError, e:
self.logger.exception("Error in libvirt backend")
raise virt.VirtError(str(e))
def listDomains(self):
""" Get list of all domains. """
domains = []
self._connect()
try:
# Active domains
for domainID in self.virt.listDomainsID():
domain = self.virt.lookupByID(domainID)
if domain.UUIDString() == "00000000-0000-0000-0000-000000000000":
# Don't send Domain-0 on xen (zeroed uuid)
continue
domains.append(virt.Domain(self.virt, domain))
self.logger.debug("Virtual machine found: %s: %s" % (domain.name(), domain.UUIDString()))
# Non active domains
for domainName in self.virt.listDefinedDomains():
domain = self.virt.lookupByName(domainName)
domains.append(virt.Domain(self.virt, domain))
self.logger.debug("Virtual machine found: %s: %s" % (domainName, domain.UUIDString()))
except libvirt.libvirtError, e:
raise virt.VirtError(str(e))
return domains
In other words every call to Libvirtd.listDomains() opens a new connection to
libvirtd and does not close it. So it just waits for the destructor to be
called, which does not happen immediately when virt goes out of scope (AFAIK).
In /usr/share/virt-who/virtwho.py:
def _readGuests(self, config):
virt = Virt.fromConfig(self.logger, config)
if not self.options.oneshot and virt.canMonitor():
virt.startMonitoring(self.sync_event)
if config.type not in ["esx", "rhevm", "hyperv"]:
return virt.listDomains()
else:
return virt.getHostGuestMapping()
Here virt is instantiated from Libvirtd and then virt.listDomains() is called,
which opens a new connection. Afterwards the virt object gets out of scope
without ever closing the connection to libvirtd.
And _readGuests is called from _send, send, run:
def run(self):
if self.options.background and self.options.virtType == "libvirt":
self.logger.debug("Starting infinite loop with %d seconds interval and event handling" % self.options.interval)
else:
self.logger.debug("Starting infinite loop with %d seconds interval" % self.options.interval)
while 1:
# Run in infinite loop and send list of UUIDs every 'options.interval' seconds
if self.send():
timeout = self.options.interval
else:
timeout = RetryInterval
self.sync_event.wait(timeout)
self.sync_event.clear()
In other words after several iterations of this infinite loop, virt-who
consumes all connections allowed for any client of libvirtd.
And even more interesting issue with virt-who is the number of threads running
(and likely trying to connect to libvirtd):
# ps -ef | grep virt-who
root 11805 1 64 Jun26 ? 17:47:03 /usr/bin/python /usr/share/virt-who/virtwho.py
# ls /proc/11805/task/ | wc -l
3191
And the number of threads increases over time.
Sure, will fix it today or tomorrow. Fixed in virt-who-0.10-3.el6. Petr, good to know, thanks for testing. Verified it on virt-who-0.10-3.el6 Steps to verify: 1. Settings libvirt as the following: cat /etc/libvirt/libvirtd.conf listen_tls = 0 listen_tcp = 1 auth_tcp = "sasl" tcp_port = "16509" 2. Restart libvirtd service # service libvirtd restart 3. tail -f /var/log/libvirt/libvirtd.log ,there isn't any error message as the following: 2014-06-27 09:36:14.984+0000: 4434: error : virNetServerAddClient:270 : Too many active clients (20), dropping connection from 127.0.0.1;0 4. No error message show after run "virsh list" [root@hp-z220-05 libvirt-test-API]# virsh list Id Name State ---------------------------------------------------- 2 6.5_Server_x86_64 running [root@hp-z220-05 libvirt-test-API]# virsh list --all Id Name State ---------------------------------------------------- 2 6.5_Server_x86_64 running - 5.10_Server_x86_64 shut off - 6.4_Server_x86_64 shut off - 6.5_Client_i386 shut off - 7.0_Server_x86_64 shut off 5. Check virt-who's thread is always 2 [root@hp-z220-05 libvirt-test-API]# ps -ef | grep virt-who root 1510 1 1 10:44 ? 00:02:14 /usr/bin/python /usr/share/virt-who/virtwho.py root 4405 31169 0 13:57 pts/0 00:00:00 grep virt-who [root@hp-z220-05 libvirt-test-API]# ls /proc/1510/task/ | wc -l 2 [root@hp-z220-05 libvirt-test-API]# ls /proc/1510/task/ | wc -l 2 [root@hp-z220-05 libvirt-test-API]# ls /proc/1510/task/ | wc -l 2 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1513.html |