【问题标题】:Twisted Could not accept new connection (EMFILE)Twisted 无法接受新连接 (EMFILE)
【发布时间】:2014-11-18 11:31:51
【问题描述】:

无法接受新连接 (EMFILE) - 此消息每秒钟多次附加到日志中,并且服务器不强调连接。它发生在 2000 多个连接之后。

 #lsof | wc -l
2309

 #ulimit -n
655360

 #uname -a
Linux .... 2.6.39-400.215.11.el6uek.x86_64 #1 SMP Wed Oct 15 13:07:26 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux

我使用 EPollReactor(扭曲的 12.1.0):

从 twisted.internet 导入 epollreactor
epollreactor.install()

我能做什么?
对不起我的英语。

【问题讨论】:

    标签: python linux twisted


    【解决方案1】:

    每个用户、每个进程或每个计算机的可用文件描述符都用完了。

    您可能需要更改一些ulimitsysctl 参数以增加这些限制。

    根据您的操作系统,这可能会略有不同。例如,here's the relevant chapter of the FreeBSD handbook 关于 sysctl 的调整限制。

    【讨论】:

    • 我已经在 /etc/security/limits.conf 中将 nfile 增加到 655360 ` root soft nofile 655360 root hard nofile 655360 ` deamon work as root
    • # cat /proc/*deamon_pid*/limits Limit Soft Limit Hard Limit Units 最大打开文件数 655360 655360 个文件
    【解决方案2】:

    增加限制并不能解决问题,只会延迟问题。 只有一个问题,您必须对请求进行排队,并在套接字或文件描述符用完时等待,直到某些再次可用。 看看https://caolan.github.io/async/docs.html#queue 的作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-02
      • 2016-10-24
      • 2016-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-18
      相关资源
      最近更新 更多