Why am I getting ‘Errno(105): No buffer space available’ when subscribing to multicast addresses?

I have been experiencing multicast subscription when subscribing to more that 20 IP’s via smcroute and python socket module. After vigorous googling I finally found a fix.

Screenshot_2017-06-28_11-59-55.png

Linux OS, limit the number of multicast group memberships that a machine can belong to simultaneously. (A “multicast group membership” indicates that a machine is listening to messages for a specific multicast IP address. In other words, there is a limit on how many multicast IP addresses you can listen to.)

On Linux, in particular, the default limit is relatively small (only 20 on many standard kernels). However, this limit can be configured dynamically.

If you try to subscribe to too many multicast addresses at once, you may run into the error message below:

daemon error: Warn: ADD MEMBERSHIP failed; Errno(105): No buffer space available
22
daemon error: Warn: ADD MEMBERSHIP failed; Errno(105): No buffer space available
23
daemon error: Warn: ADD MEMBERSHIP failed; Errno(105): No buffer space available

The “Errno 105” in this message indicates that the errno value returned by the Linux network stack is 105, or ENOBUFS. This return value while adding a multicast address indicates that your machine is trying to be a member of too many multicast groups at the same time.

Network Tuning

Solution is to tune your kernel, backup your current sysclt.conf and replace contents with the ones below.

sudo vim /etc/sysctl.conf

# Bigger buffers (to make 40Gb more practical). These are maximums, but
# the default is unaffected.
net.core.wmem_max=268435456
net.core.rmem_max=268435456
net.core.netdev_max_backlog=10000

# Avoids problems with multicast traffic arriving on non-default interfaces
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0

# Force IGMP v2 (required by CBF switch)
net.ipv4.conf.all.force_igmp_version=2
net.ipv4.conf.default.force_igmp_version=2

# Increase the ARP cache table
net.ipv4.neigh.default.gc_thresh3 = 4096
net.ipv4.neigh.default.gc_thresh2 = 2048
net.ipv4.neigh.default.gc_thresh1 = 1024

# Increase number of multicast groups permitted
net.ipv4.igmp_max_memberships = 1024

You can reload the configuration file by executing, sudo sysctl -p or by rebooting your system.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s