OSError 105:没有缓冲区空间-Zeroconf



我使用的是NanoPi M1(Allwinner H3板)&运行基于Yocto的操作系统。在我第一次遇到ZeroConf python时,

>>> from zeroconf import Zeroconf, ServiceBrowser
>>> zero = Zeroconf()

我得到错误:

File "/usr/lib/python3.5/site-packages/zeroconf.py", line 1523, in __init__
socket.inet_aton(_MDNS_ADDR) + socket.inet_aton(i))
OSError: [Errno 105] No buffer space available

当我在Raspbian(在RPI上)中运行它时,不会出现这个错误。我试着在homeassistant中搜索此类错误的修复方法,但没有一个能很好地概述真正的问题,抛开解决方案不谈。

Neelotpal答案的一个补充:

这篇文章包括一个很好的解决方案建议,所有选项都可以检查这个问题:

# 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

我不建议盲目复制这些值,而是系统地测试是哪一个限制了您的资源:

  1. 使用sysctl <property>获取当前设置的值
  2. 通过检查系统统计信息来验证属性当前是否在极限运行
  3. 使用sysctl -w或直接更改/etc/sysctl.conf并通过sysctl -p重新加载来更改Neelotpal描述的配置

在我的情况下,增加net.ipv4.igmp_max_memberships起到了作用:

  1. 我用sysctl net.ipv4.igmp_max_memberships检查了电流值,它是20
  2. 我检查了netstat -gn有多少成员资格,意识到我的许多docker容器占据了其中的大部分
  3. 最后,我增加了syctl.conf的价值,它起到了作用

当然,阅读这些属性以了解它们的实际作用也是很好的,例如在sysctl-explorer.net上

sysctlnet/ipv4/igmp_max_memberships值更新为大于零。在终端上执行以下命令:$ sysctl -w net.ipv4.igmp_max_memberships=20(或任何其他大于零的值)&$ sysctl -w net.ipv4.igmp_max_msf=10

然后,重新启动avahi守护进程systemctl restart avahi-daemon

您可以使用验证上述密钥的现有值"sysctl net.ipv4.igmp_max_memberships".

最新更新