libvirtd "error : Too many active clients dropping connection" why ?.

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5

Issue

  • libvirtd "error : Too many active clients  dropping connection".
  • The below error message occurs in /var/log/messages

    Mar 22 XX:XX:XX xyz libvirtd: 08:34:01.480: error : Too many active clients (20), dropping connection 
    Mar 22 XX:XX:XX xyz libvirtd: 08:36:01.827: error : Too many active clients (20), dropping connection 
    

Resolution

Increase limit of max clients: edit /etc/libvirt/libvirtd.conf and change max_clients to a higher value than 20 which is default and then restart libvirt service.

keep the max_workers and max_requests equal to max_clients.

#################################################################
#
# Processing controls
#

# The maximum number of concurrent client connections to allow
# over all sockets combined.
#max_clients = 20


# The minimum limit sets the number of workers to start up
# initially. If the number of active clients exceeds this,
# then more threads are spawned, upto max_workers limit.
# Typically you'd want max_workers to equal maximum number
# of clients allowed
#min_workers = 5
#max_workers = 20

# Total global limit on concurrent RPC calls. Should be
# at least as large as max_workers. Beyond this, RPC requests
# will be read into memory and queued. This directly impact
# memory usage, currently each request requires 256 KB of
# memory. So by default upto 5 MB of memory is used
#
# XXX this isn't actually enforced yet, only the per-client
# limit is used so far
#max_requests = 20

# Limit on concurrent requests from a single client
# connection. To avoid one client monopolizing the server
# this should be a small fraction of the global max_requests
# and max_workers parameter
#max_client_requests = 5

Root Cause

This message means that libvirt daemon has achieved the number maximum of applications connected to it.

Example of applications: virsh, virt-manager

# The maximum number of concurrent client connections to allow
# over all sockets combined.
#max_clients = 20

Comments

It is pretty tricky to diagnose this reasonably from the client end, since the server is essentially close()ing the socket the moment it has accept()d it without writing any data.

Memory implications of the max_clients setting

The configuration settings for libvirtd impact its potential max  memory usage. Each client RPC request uses approx 256 KB, and we allow 5  concurrent requests per client socket. Multiply by 20 clients, this  translates to about 25 MB of memory usage for RPC handling code with the  default limits in the worst case.

Given the typical RAM available for RHEL deployments, it is probably safe to raise this to at least 100 clients.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments