如何编译具有 >1024 个文件描述符的 python?
Supervisord 中问题的解决方法是: “编译一个支持 > 1024 个文件描述符的 Python”
https://github.com/Supervisor/supervisor /issues/26
有人可以指导我完成此任务需要进行哪些更改吗?我已经提取了 python 2.7.2 源代码并准备就绪。
运行 centos 5.6,如果这很重要的话。
谢谢。
更新:ulimit -n 已设置为 65535。这是我在启动supervisord 时遇到的完整错误:
回溯(最近一次调用最后一次): 文件“/usr/local/bin/supervisord”,第 8 行,位于 load_entry_point('supervisor==3.0a10', 'console_scripts', 'supervisord')() 文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py”,第 372 行,在 main 中 去(选项) 文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py”,第 382 行,在 go d.main()
文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py”,第 95 行,在 main 中 self.run()
文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py”,第 112 行,运行中 self.runforever()
文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py”,第 230 行,在 runforever 中 r, w, x = self.options.select(r, w, x, 超时)
文件“/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/options.py”,第 1113 行,选择 返回 select.select(r, w, x, 超时) ValueError:文件描述符超出 select() 范围
The workaround for an issue in supervisord is to:
"compile a Python that supports > 1024 file descriptors"
https://github.com/Supervisor/supervisor/issues/26
Can someone please walk me through what changes are necessary to accomplish this? I have the python 2.7.2 source extracted and ready to go.
Running centos 5.6, if that matters.
Thanks.
Update: ulimit -n is already set to 65535. This is the full error I'm getting when starting supervisord:
Traceback (most recent call last):
File "/usr/local/bin/supervisord", line 8, in
load_entry_point('supervisor==3.0a10', 'console_scripts', 'supervisord')()
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py", line 372, in main
go(options)
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py", line 382, in go d.main()
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py", line 95, in main
self.run()
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py", line 112, in run
self.runforever()
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/supervisord.py", line 230, in runforever
r, w, x = self.options.select(r, w, x, timeout)
File "/usr/local/lib/python2.7/site-packages/supervisor-3.0a10-py2.7.egg/supervisor/options.py", line 1113, in select
return select.select(r, w, x, timeout)
ValueError: filedescriptor out of range in select()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上是底层
select(2)
系统调用的限制。从手册页来看:
标准 FD_SETSIZE 是 1024。
所以这不是 Python 问题。
poll(2)
和epoll(2)
系统调用有更大的限制。您真正需要做的是使用select.epoll
对象(仍在select
模块中)而不是 `select。That's actually the limit of the underlying
select(2)
system call.From the man page:
And the standard FD_SETSIZE is 1024.
So it's not a Python issue. The
poll(2)
andepoll(2)
system calls have a much larger limit. What you really need to do use use theselect.epoll
object (still in theselect
module) instead of `select.