socket.accept error 24: To many open files

前端 未结 3 610
予麋鹿
予麋鹿 2020-12-12 21:11

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

3条回答
  •  孤城傲影
    2020-12-12 22:10

    You can also do this from your python code like below

    import resource
    resource.setrlimit(resource.RLIMIT_NOFILE, (65536, 65536))
    

    The second argument is tuple (soft_limit, hard_limit). The hard limit is the ceiling for the soft limit. The soft limit is what is actually enforced for a session or process. This allows the administrator (or user) to set the hard limit to the maximum usage they wish to allow. Other users and processes can then use the soft limit to self-limit their resource usage to even lower levels if they so desire.

提交回复
热议问题