套接字。接受错误24:对许多打开的文件
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..
在运行Python2.6版本的服务器时,我在Ubuntu 9.10下有一个打开文件的问题,主要的问题是,我不知道为什么会这样。
I have set
我已经设置
ulimit -n = 999999
ulimit - n = 999999
net.core.somaxconn = 999999
net.core。somaxconn = 999999
fs.file-max = 999999
fs。file-max = 999999
and lsof gives me about 12000 open files when server is running.
lsof在服务器运行时向我提供12000个打开文件。
And also i'm using epoll.
我还用了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
文件“/ usr / lib / python2.6 /插座。第195行,accept error: [Errno 24]打开的文件太多
And i don't know how it can reach file limit when it isn't reached.
我也不知道当它没有达到文件限制时,它是如何达到文件限制的。
Thanks for help)
谢谢你的帮助)
2 个解决方案
#1
20
Params that configure max open connections.
配置最大打开连接的参数。
at /etc/sysctl.conf
在/etc/sysctl.conf
add:
添加:
net.core.somaxconn=131072
fs.file-max=131072
and then:
然后:
sudo sysctl -p
at /usr/include/linux/limits.h
在/usr/include/linux/limits.h
change:
变化:
NR_OPEN = 65536
at /etc/security/limits.conf
在/etc/security/limits.conf
add:
添加:
* soft nofile 65535
* hard nofile 65535
更多相关文章
- Python之错误异常和文件处理
- python解析json文件读取Android permission说明
- python 之 logger日志 字典配置文件
- [置顶] Python + C/C++ 嵌入式编程(1):多维数组Numpy.Array(
- 使用python api递归计算每个Dropbox文件夹大小
- 如何在python中播放wav文件?
- python多线程文件传输范例(C/S)
- Python - 将值打印到新文件?
- 如何让TkInter文件选择对话框与IPython / Spyder一起使用?