socket.accept错误24:许多打开的文件 [英] socket.accept error 24: To many open files

查看:607
本文介绍了socket.accept错误24:许多打开的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 9.10中打开文件时遇到问题,在Python2.6中运行服务器
主要问题是,我不知道为什么这样..



我已设置



ulimit -n = 999999



net.core.somaxconn = 999999



fs.file-max = 999999



和lsof给我约12000个打开文件,当服务器运行。



还有我正在使用epoll。



但是经过一段时间,它开始放弃: / p>

文件/usr/lib/python2.6/socket.py,第195行,接受
错误:[Errno 24]打开文件太多



如果没有达到文件限制,我不知道如何达到文件限制。



感谢帮助)

解决方案

配置最大打开连接的参数。



/etc/sysctl.conf



add:

  net.core .somaxconn = 131072 
fs.file-max = 131072

然后:

  sudo sysctl -p 

在/usr/include/linux/limits.h



更改: / p>

  NR_OPEN = 65536 

在/etc/security/limits.conf



add:

 code> * soft nofile 65535 
* hard nofile 65535


I have a problem with open files under my Ubuntu 9.10 when running server in Python2.6 And main problem is that, that i don't know why it so..

I have set

ulimit -n = 999999

net.core.somaxconn = 999999

fs.file-max = 999999

and lsof gives me about 12000 open files when server is running.

And also i'm using epoll.

But after some time it's start giving exeption:

File "/usr/lib/python2.6/socket.py", line 195, in accept error: [Errno 24] Too many open files

And i don't know how it can reach file limit when it isn't reached.

Thanks for help)

解决方案

Params that configure max open connections.

at /etc/sysctl.conf

add:

net.core.somaxconn=131072
fs.file-max=131072

and then:

sudo sysctl -p

at /usr/include/linux/limits.h

change:

NR_OPEN = 65536

at /etc/security/limits.conf

add:

*                soft    nofile          65535
*                hard    nofile          65535

这篇关于socket.accept错误24:许多打开的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆